mirror of https://github.com/apache/jclouds.git
JCLOUDS-150 - Removal of async from AWS - specifically EC2
...and EC2-related elsewhere. Also moved *Client -> *Api, and moved everything from .../services to .../features, and threw in a bunch of Optionals to fit the EC2Api approach. And a very big tip of the hat to nacx for figuring out the generics stuff my brain just could not handle. =)
This commit is contained in:
parent
5f524ee6c9
commit
5f3b8d3fa7
|
@ -21,12 +21,12 @@
|
||||||
org.jclouds.ec2.ami2
|
org.jclouds.ec2.ami2
|
||||||
(:use org.jclouds.compute2)
|
(:use org.jclouds.compute2)
|
||||||
(:import org.jclouds.aws.domain.Region
|
(:import org.jclouds.aws.domain.Region
|
||||||
org.jclouds.ec2.services.AMIClient
|
org.jclouds.ec2.features.AMIApi
|
||||||
org.jclouds.ec2.options.CreateImageOptions
|
org.jclouds.ec2.options.CreateImageOptions
|
||||||
org.jclouds.compute.domain.NodeMetadata
|
org.jclouds.compute.domain.NodeMetadata
|
||||||
(org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo)))
|
(org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo)))
|
||||||
|
|
||||||
(defn ^org.jclouds.ec2.services.AMIClient
|
(defn ^org.jclouds.ec2.features.AMIApi
|
||||||
ami-service
|
ami-service
|
||||||
""
|
""
|
||||||
[compute]
|
[compute]
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
.getContext
|
.getContext
|
||||||
.getProviderSpecificContext
|
.getProviderSpecificContext
|
||||||
.getApi
|
.getApi
|
||||||
.getAMIServices))
|
.getAMIApi().get))
|
||||||
|
|
||||||
(defn get-region
|
(defn get-region
|
||||||
"Coerces the first parameter into a Region string; strings, keywords, and
|
"Coerces the first parameter into a Region string; strings, keywords, and
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
(:import org.jclouds.compute.domain.NodeMetadata
|
(:import org.jclouds.compute.domain.NodeMetadata
|
||||||
(org.jclouds.ec2.domain PublicIpInstanceIdPair)))
|
(org.jclouds.ec2.domain PublicIpInstanceIdPair)))
|
||||||
|
|
||||||
(defn ^org.jclouds.ec2.services.ElasticIPAddressClient
|
(defn ^org.jclouds.ec2.features.ElasticIPAddressApi
|
||||||
eip-service
|
eip-service
|
||||||
"Returns an ElasticIPAddressClient for the given ComputeService"
|
"Returns an ElasticIPAddressApi for the given ComputeService"
|
||||||
[compute]
|
[compute]
|
||||||
(-> compute
|
(-> compute
|
||||||
.getContext .getProviderSpecificContext .getApi .getElasticIPAddressServices))
|
.getContext .getProviderSpecificContext .getApi .getElasticIPAddressApi().get))
|
||||||
|
|
||||||
(defn allocate
|
(defn allocate
|
||||||
"Claims a new elastic IP address within the (optionally) specified region for your account.
|
"Claims a new elastic IP address within the (optionally) specified region for your account.
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
(:require (org.jclouds [compute2 :as compute])
|
(:require (org.jclouds [compute2 :as compute])
|
||||||
[org.jclouds.ec2.ebs2 :as ebs])
|
[org.jclouds.ec2.ebs2 :as ebs])
|
||||||
(:import org.jclouds.ec2.domain.SecurityGroup
|
(:import org.jclouds.ec2.domain.SecurityGroup
|
||||||
org.jclouds.ec2.services.SecurityGroupClient
|
org.jclouds.ec2.features.SecurityGroupApi
|
||||||
org.jclouds.net.domain.IpProtocol))
|
org.jclouds.net.domain.IpProtocol))
|
||||||
|
|
||||||
(defn #^SecurityGroupClient
|
(defn #^SecurityGroupApi
|
||||||
sg-service
|
sg-service
|
||||||
"Returns the SecurityGroup Client associated with the specified compute service."
|
"Returns the SecurityGroup Api associated with the specified compute service."
|
||||||
[compute]
|
[compute]
|
||||||
(-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupServices))
|
(-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupApi().get))
|
||||||
|
|
||||||
(defn create-group
|
(defn create-group
|
||||||
"Creates a new security group.
|
"Creates a new security group.
|
||||||
|
|
|
@ -21,6 +21,13 @@ import java.util.Set;
|
||||||
import org.jclouds.ec2.features.SubnetApi;
|
import org.jclouds.ec2.features.SubnetApi;
|
||||||
import org.jclouds.ec2.features.TagApi;
|
import org.jclouds.ec2.features.TagApi;
|
||||||
import org.jclouds.ec2.features.WindowsApi;
|
import org.jclouds.ec2.features.WindowsApi;
|
||||||
|
import org.jclouds.ec2.features.AMIApi;
|
||||||
|
import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
|
||||||
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
|
import org.jclouds.ec2.features.ElasticIPAddressApi;
|
||||||
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
|
import org.jclouds.ec2.features.KeyPairApi;
|
||||||
|
import org.jclouds.ec2.features.SecurityGroupApi;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
|
@ -42,12 +49,11 @@ import com.google.inject.Provides;
|
||||||
* Example
|
* Example
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Optional<? extends WindowsApi> windowsOption = ec2Client.getWindowsApi();
|
* Optional<? extends WindowsApi> windowsOption = ec2Api.getWindowsApi();
|
||||||
* checkState(windowsOption.isPresent(), "windows feature required, but not present");
|
* checkState(windowsOption.isPresent(), "windows feature required, but not present");
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see EC2AsyncApi
|
|
||||||
*/
|
*/
|
||||||
public interface EC2Api extends Closeable {
|
public interface EC2Api extends Closeable {
|
||||||
/**
|
/**
|
||||||
|
@ -87,4 +93,75 @@ public interface EC2Api extends Closeable {
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<? extends SubnetApi> getSubnetApiForRegion(
|
Optional<? extends SubnetApi> getSubnetApiForRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to AMI services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends AMIApi> getAMIApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends AMIApi> getAMIApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to Elastic IP Address services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends ElasticIPAddressApi> getElasticIPAddressApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends ElasticIPAddressApi> getElasticIPAddressApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to Instance services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends InstanceApi> getInstanceApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends InstanceApi> getInstanceApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to KeyPair services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends KeyPairApi> getKeyPairApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends KeyPairApi> getKeyPairApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to SecurityGroup services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends SecurityGroupApi> getSecurityGroupApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends SecurityGroupApi> getSecurityGroupApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to Availability Zones and Regions services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to Elastic Block Store services.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends ElasticBlockStoreApi> getElasticBlockStoreApi();
|
||||||
|
|
||||||
|
@Delegate
|
||||||
|
Optional<? extends ElasticBlockStoreApi> getElasticBlockStoreApiForRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.ec2.compute.EC2ComputeServiceContext;
|
import org.jclouds.ec2.compute.EC2ComputeServiceContext;
|
||||||
import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
|
import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
|
||||||
import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
|
import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
|
||||||
import org.jclouds.ec2.config.EC2RestClientModule;
|
import org.jclouds.ec2.config.EC2HttpApiModule;
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseHttpApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
@ -55,16 +55,8 @@ import com.google.inject.Module;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class EC2ApiMetadata extends BaseRestApiMetadata {
|
public class EC2ApiMetadata extends BaseHttpApiMetadata<EC2Api> {
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(EC2Client.class)} as
|
|
||||||
* {@link EC2AsyncClient} interface will be removed in jclouds 1.7.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static final TypeToken<org.jclouds.rest.RestContext<? extends EC2Client, ? extends EC2AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<? extends EC2Client, ? extends EC2AsyncClient>>() {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
|
@ -80,7 +72,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Properties defaultProperties() {
|
public static Properties defaultProperties() {
|
||||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
Properties properties = BaseHttpApiMetadata.defaultProperties();
|
||||||
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
||||||
properties.setProperty(PROPERTY_HEADER_TAG, "amz");
|
properties.setProperty(PROPERTY_HEADER_TAG, "amz");
|
||||||
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*");
|
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*");
|
||||||
|
@ -91,14 +83,8 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
public abstract static class Builder<T extends Builder<T>> extends BaseHttpApiMetadata.Builder<EC2Api, T> {
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
this(EC2Client.class, EC2AsyncClient.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Builder(Class<?> syncClient, Class<?> asyncClient) {
|
|
||||||
super(syncClient, asyncClient);
|
|
||||||
id("ec2")
|
id("ec2")
|
||||||
.name("Amazon Elastic Compute Cloud (EC2) API")
|
.name("Amazon Elastic Compute Cloud (EC2) API")
|
||||||
.identityName("Access Key ID")
|
.identityName("Access Key ID")
|
||||||
|
@ -107,9 +93,8 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
||||||
.documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference"))
|
.documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference"))
|
||||||
.version("2010-06-15")
|
.version("2010-06-15")
|
||||||
.defaultProperties(EC2ApiMetadata.defaultProperties())
|
.defaultProperties(EC2ApiMetadata.defaultProperties())
|
||||||
.context(CONTEXT_TOKEN)
|
|
||||||
.view(EC2ComputeServiceContext.class)
|
.view(EC2ComputeServiceContext.class)
|
||||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(EC2RestClientModule.class, EC2ResolveImagesModule.class, EC2ComputeServiceContextModule.class));
|
.defaultModules(ImmutableSet.<Class<? extends Module>>of(EC2HttpApiModule.class, EC2ResolveImagesModule.class, EC2ComputeServiceContextModule.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2;
|
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.ec2.features.SubnetAsyncApi;
|
|
||||||
import org.jclouds.ec2.features.TagAsyncApi;
|
|
||||||
import org.jclouds.ec2.features.WindowsAsyncApi;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.Region;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refer to javadoc for {@link EC2Api}, as this interface is the same, except
|
|
||||||
* features provide asynchronous return values.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public interface EC2AsyncApi extends Closeable {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return the Region codes configured
|
|
||||||
*/
|
|
||||||
@Provides
|
|
||||||
@Region
|
|
||||||
Set<String> getConfiguredRegions();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Windows features.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
Optional<? extends WindowsAsyncApi> getWindowsApi();
|
|
||||||
|
|
||||||
@Delegate
|
|
||||||
Optional<? extends WindowsAsyncApi> getWindowsApiForRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Tag features.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
Optional<? extends TagAsyncApi> getTagApi();
|
|
||||||
|
|
||||||
@Delegate
|
|
||||||
Optional<? extends TagAsyncApi> getTagApiForRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Subnet features.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
Optional<? extends SubnetAsyncApi> getSubnetApi();
|
|
||||||
|
|
||||||
@Delegate
|
|
||||||
Optional<? extends SubnetAsyncApi> getSubnetApiForRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2;
|
|
||||||
|
|
||||||
import org.jclouds.ec2.services.AMIAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.InstanceAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.KeyPairAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.SecurityGroupAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.WindowsAsyncClient;
|
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to EC2 services.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(EC2Client.class)} as
|
|
||||||
* {@link EC2AsyncClient} interface will be removed in jclouds 1.7.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public interface EC2AsyncClient extends EC2AsyncApi {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to AMI services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
AMIAsyncClient getAMIServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Elastic IP Address services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
ElasticIPAddressAsyncClient getElasticIPAddressServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Instance services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
InstanceAsyncClient getInstanceServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to KeyPair services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
KeyPairAsyncClient getKeyPairServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to SecurityGroup services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
SecurityGroupAsyncClient getSecurityGroupServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Windows services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
WindowsAsyncClient getWindowsServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Availability Zones and Regions services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
AvailabilityZoneAndRegionAsyncClient getAvailabilityZoneAndRegionServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Elastic Block Store services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
ElasticBlockStoreAsyncClient getElasticBlockStoreServices();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2;
|
|
||||||
|
|
||||||
import org.jclouds.ec2.services.AMIClient;
|
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressClient;
|
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
|
||||||
import org.jclouds.ec2.services.KeyPairClient;
|
|
||||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
|
||||||
import org.jclouds.ec2.services.WindowsClient;
|
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to EC2 services.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public interface EC2Client extends EC2Api {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to AMI services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
AMIClient getAMIServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to Elastic IP Address services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
ElasticIPAddressClient getElasticIPAddressServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to Instance services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
InstanceClient getInstanceServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to KeyPair services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
KeyPairClient getKeyPairServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to SecurityGroup services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
SecurityGroupClient getSecurityGroupServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to Windows services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
WindowsClient getWindowsServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to Availability Zones and Regions services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
AvailabilityZoneAndRegionClient getAvailabilityZoneAndRegionServices();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to Elastic Block Store services.
|
|
||||||
*/
|
|
||||||
@Delegate
|
|
||||||
ElasticBlockStoreClient getElasticBlockStoreServices();
|
|
||||||
|
|
||||||
}
|
|
|
@ -73,7 +73,7 @@ import org.jclouds.compute.strategy.ResumeNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
||||||
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
||||||
|
@ -104,7 +104,7 @@ import com.google.inject.Inject;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EC2ComputeService extends BaseComputeService {
|
public class EC2ComputeService extends BaseComputeService {
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
|
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
|
||||||
private final LoadingCache<RegionAndName, String> securityGroupMap;
|
private final LoadingCache<RegionAndName, String> securityGroupMap;
|
||||||
private final Factory namingConvention;
|
private final Factory namingConvention;
|
||||||
|
@ -125,7 +125,7 @@ public class EC2ComputeService extends BaseComputeService {
|
||||||
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
||||||
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
||||||
PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
|
PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, EC2Client client,
|
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, EC2Api client,
|
||||||
ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
|
ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
|
||||||
@Named("SECURITY") LoadingCache<RegionAndName, String> securityGroupMap,
|
@Named("SECURITY") LoadingCache<RegionAndName, String> securityGroupMap,
|
||||||
Optional<ImageExtension> imageExtension, GroupNamingConvention.Factory namingConvention,
|
Optional<ImageExtension> imageExtension, GroupNamingConvention.Factory namingConvention,
|
||||||
|
@ -212,9 +212,9 @@ public class EC2ComputeService extends BaseComputeService {
|
||||||
checkNotNull(emptyToNull(group), "group must be defined");
|
checkNotNull(emptyToNull(group), "group must be defined");
|
||||||
String groupName = namingConvention.create().sharedNameForGroup(group);
|
String groupName = namingConvention.create().sharedNameForGroup(group);
|
||||||
|
|
||||||
if (client.getSecurityGroupServices().describeSecurityGroupsInRegion(region, groupName).size() > 0) {
|
if (client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(region, groupName).size() > 0) {
|
||||||
logger.debug(">> deleting securityGroup(%s)", groupName);
|
logger.debug(">> deleting securityGroup(%s)", groupName);
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(region, groupName);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegion(region, groupName);
|
||||||
// TODO: test this clear happens
|
// TODO: test this clear happens
|
||||||
securityGroupMap.invalidate(new RegionNameAndIngressRules(region, groupName, null, false));
|
securityGroupMap.invalidate(new RegionNameAndIngressRules(region, groupName, null, false));
|
||||||
logger.debug("<< deleted securityGroup(%s)", groupName);
|
logger.debug("<< deleted securityGroup(%s)", groupName);
|
||||||
|
@ -223,20 +223,20 @@ public class EC2ComputeService extends BaseComputeService {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void deleteKeyPair(String region, String group) {
|
void deleteKeyPair(String region, String group) {
|
||||||
for (KeyPair keyPair : client.getKeyPairServices().describeKeyPairsInRegion(region)) {
|
for (KeyPair keyPair : client.getKeyPairApi().get().describeKeyPairsInRegion(region)) {
|
||||||
String keyName = keyPair.getKeyName();
|
String keyName = keyPair.getKeyName();
|
||||||
Predicate<String> keyNameMatcher = namingConvention.create().containsGroup(group);
|
Predicate<String> keyNameMatcher = namingConvention.create().containsGroup(group);
|
||||||
String oldKeyNameRegex = String.format("jclouds#%s#%s#%s", group, region, "[0-9a-f]+").replace('#', delimiter);
|
String oldKeyNameRegex = String.format("jclouds#%s#%s#%s", group, region, "[0-9a-f]+").replace('#', delimiter);
|
||||||
// old keypair pattern too verbose as it has an unnecessary region qualifier
|
// old keypair pattern too verbose as it has an unnecessary region qualifier
|
||||||
|
|
||||||
if (keyNameMatcher.apply(keyName) || keyName.matches(oldKeyNameRegex)) {
|
if (keyNameMatcher.apply(keyName) || keyName.matches(oldKeyNameRegex)) {
|
||||||
Set<String> instancesUsingKeyPair = extractIdsFromInstances(filter(concat(client.getInstanceServices()
|
Set<String> instancesUsingKeyPair = extractIdsFromInstances(filter(concat(client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(region)), usingKeyPairAndNotDead(keyPair)));
|
.describeInstancesInRegion(region)), usingKeyPairAndNotDead(keyPair)));
|
||||||
if (instancesUsingKeyPair.size() > 0) {
|
if (instancesUsingKeyPair.size() > 0) {
|
||||||
logger.debug("<< inUse keyPair(%s), by (%s)", keyPair.getKeyName(), instancesUsingKeyPair);
|
logger.debug("<< inUse keyPair(%s), by (%s)", keyPair.getKeyName(), instancesUsingKeyPair);
|
||||||
} else {
|
} else {
|
||||||
logger.debug(">> deleting keyPair(%s)", keyPair.getKeyName());
|
logger.debug(">> deleting keyPair(%s)", keyPair.getKeyName());
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(region, keyPair.getKeyName());
|
client.getKeyPairApi().get().deleteKeyPairInRegion(region, keyPair.getKeyName());
|
||||||
// TODO: test this clear happens
|
// TODO: test this clear happens
|
||||||
credentialsMap.remove(new RegionAndName(region, keyPair.getKeyName()));
|
credentialsMap.remove(new RegionAndName(region, keyPair.getKeyName()));
|
||||||
credentialsMap.remove(new RegionAndName(region, group));
|
credentialsMap.remove(new RegionAndName(region, group));
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.compute.extensions.ImageExtension;
|
import org.jclouds.compute.extensions.ImageExtension;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.ec2.options.CreateImageOptions;
|
import org.jclouds.ec2.options.CreateImageOptions;
|
||||||
|
@ -69,16 +69,16 @@ public class EC2ImageExtension implements ImageExtension {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
private final EC2Client ec2Client;
|
private final EC2Api ec2Api;
|
||||||
private final ListeningExecutorService userExecutor;
|
private final ListeningExecutorService userExecutor;
|
||||||
private final Supplier<Set<? extends Location>> locations;
|
private final Supplier<Set<? extends Location>> locations;
|
||||||
private final Predicate<AtomicReference<Image>> imageAvailablePredicate;
|
private final Predicate<AtomicReference<Image>> imageAvailablePredicate;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public EC2ImageExtension(EC2Client ec2Client, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
|
public EC2ImageExtension(EC2Api ec2Api, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
|
||||||
@Memoized Supplier<Set<? extends Location>> locations,
|
@Memoized Supplier<Set<? extends Location>> locations,
|
||||||
@Named(TIMEOUT_IMAGE_AVAILABLE) Predicate<AtomicReference<Image>> imageAvailablePredicate) {
|
@Named(TIMEOUT_IMAGE_AVAILABLE) Predicate<AtomicReference<Image>> imageAvailablePredicate) {
|
||||||
this.ec2Client = checkNotNull(ec2Client, "ec2Client");
|
this.ec2Api = checkNotNull(ec2Api, "ec2Api");
|
||||||
this.userExecutor = checkNotNull(userExecutor, "userExecutor");
|
this.userExecutor = checkNotNull(userExecutor, "userExecutor");
|
||||||
this.locations = checkNotNull(locations, "locations");
|
this.locations = checkNotNull(locations, "locations");
|
||||||
this.imageAvailablePredicate = checkNotNull(imageAvailablePredicate, "imageAvailablePredicate");
|
this.imageAvailablePredicate = checkNotNull(imageAvailablePredicate, "imageAvailablePredicate");
|
||||||
|
@ -89,7 +89,7 @@ public class EC2ImageExtension implements ImageExtension {
|
||||||
String[] parts = AWSUtils.parseHandle(id);
|
String[] parts = AWSUtils.parseHandle(id);
|
||||||
String region = parts[0];
|
String region = parts[0];
|
||||||
String instanceId = parts[1];
|
String instanceId = parts[1];
|
||||||
Reservation<? extends RunningInstance> instance = getOnlyElement(ec2Client.getInstanceServices()
|
Reservation<? extends RunningInstance> instance = getOnlyElement(ec2Api.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(region, instanceId));
|
.describeInstancesInRegion(region, instanceId));
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
throw new NoSuchElementException("Cannot find server with id: " + id);
|
throw new NoSuchElementException("Cannot find server with id: " + id);
|
||||||
|
@ -105,7 +105,7 @@ public class EC2ImageExtension implements ImageExtension {
|
||||||
String region = parts[0];
|
String region = parts[0];
|
||||||
String instanceId = parts[1];
|
String instanceId = parts[1];
|
||||||
|
|
||||||
String imageId = ec2Client.getAMIServices().createImageInRegion(region, cloneTemplate.getName(), instanceId,
|
String imageId = ec2Api.getAMIApi().get().createImageInRegion(region, cloneTemplate.getName(), instanceId,
|
||||||
CreateImageOptions.NONE);
|
CreateImageOptions.NONE);
|
||||||
|
|
||||||
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
|
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
|
||||||
|
@ -133,7 +133,7 @@ public class EC2ImageExtension implements ImageExtension {
|
||||||
String region = parts[0];
|
String region = parts[0];
|
||||||
String instanceId = parts[1];
|
String instanceId = parts[1];
|
||||||
try {
|
try {
|
||||||
ec2Client.getAMIServices().deregisterImageInRegion(region, instanceId);
|
ec2Api.getAMIApi().get().deregisterImageInRegion(region, instanceId);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.jclouds.compute.extensions.SecurityGroupExtension;
|
||||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.compute.functions.GroupNamingConvention.Factory;
|
import org.jclouds.compute.functions.GroupNamingConvention.Factory;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
|
@ -72,7 +72,7 @@ import com.google.common.util.concurrent.UncheckedTimeoutException;
|
||||||
*/
|
*/
|
||||||
public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
protected final EC2Client client;
|
protected final EC2Api client;
|
||||||
protected final ListeningExecutorService userExecutor;
|
protected final ListeningExecutorService userExecutor;
|
||||||
protected final Supplier<Set<String>> regions;
|
protected final Supplier<Set<String>> regions;
|
||||||
protected final Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> groupConverter;
|
protected final Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> groupConverter;
|
||||||
|
@ -81,7 +81,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
protected final Factory namingConvention;
|
protected final Factory namingConvention;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public EC2SecurityGroupExtension(EC2Client client,
|
public EC2SecurityGroupExtension(EC2Api client,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
|
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
|
||||||
@Region Supplier<Set<String>> regions,
|
@Region Supplier<Set<String>> regions,
|
||||||
Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> groupConverter,
|
Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> groupConverter,
|
||||||
|
@ -130,7 +130,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
String region = parts[0];
|
String region = parts[0];
|
||||||
String instanceId = parts[1];
|
String instanceId = parts[1];
|
||||||
|
|
||||||
RunningInstance instance = getOnlyElement(Iterables.concat(client.getInstanceServices().describeInstancesInRegion(region, instanceId)));
|
RunningInstance instance = getOnlyElement(Iterables.concat(client.getInstanceApi().get().describeInstancesInRegion(region, instanceId)));
|
||||||
|
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
return ImmutableSet.of();
|
return ImmutableSet.of();
|
||||||
|
@ -138,7 +138,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
Set<String> groupNames = instance.getGroupNames();
|
Set<String> groupNames = instance.getGroupNames();
|
||||||
Set<? extends org.jclouds.ec2.domain.SecurityGroup> rawGroups =
|
Set<? extends org.jclouds.ec2.domain.SecurityGroup> rawGroups =
|
||||||
client.getSecurityGroupServices().describeSecurityGroupsInRegion(region, Iterables.toArray(groupNames, String.class));
|
client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(region, Iterables.toArray(groupNames, String.class));
|
||||||
|
|
||||||
return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
|
return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
String groupId = parts[1];
|
String groupId = parts[1];
|
||||||
|
|
||||||
Set<? extends org.jclouds.ec2.domain.SecurityGroup> rawGroups =
|
Set<? extends org.jclouds.ec2.domain.SecurityGroup> rawGroups =
|
||||||
client.getSecurityGroupServices().describeSecurityGroupsInRegion(region, groupId);
|
client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(region, groupId);
|
||||||
|
|
||||||
return getOnlyElement(transform(filter(rawGroups, notNull()), groupConverter));
|
return getOnlyElement(transform(filter(rawGroups, notNull()), groupConverter));
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,8 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
String region = parts[0];
|
String region = parts[0];
|
||||||
String groupName = parts[1];
|
String groupName = parts[1];
|
||||||
|
|
||||||
if (client.getSecurityGroupServices().describeSecurityGroupsInRegion(region, groupName).size() > 0) {
|
if (client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(region, groupName).size() > 0) {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(region, groupName);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegion(region, groupName);
|
||||||
// TODO: test this clear happens
|
// TODO: test this clear happens
|
||||||
groupCreator.invalidate(new RegionNameAndIngressRules(region, groupName, null, false));
|
groupCreator.invalidate(new RegionNameAndIngressRules(region, groupName, null, false));
|
||||||
return true;
|
return true;
|
||||||
|
@ -201,7 +201,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
if (ipPermission.getCidrBlocks().size() > 0) {
|
if (ipPermission.getCidrBlocks().size() > 0) {
|
||||||
for (String cidr : ipPermission.getCidrBlocks()) {
|
for (String cidr : ipPermission.getCidrBlocks()) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
authorizeSecurityGroupIngressInRegion(region,
|
authorizeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
ipPermission.getIpProtocol(),
|
ipPermission.getIpProtocol(),
|
||||||
|
@ -214,7 +214,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
if (ipPermission.getTenantIdGroupNamePairs().size() > 0) {
|
if (ipPermission.getTenantIdGroupNamePairs().size() > 0) {
|
||||||
for (String userId : ipPermission.getTenantIdGroupNamePairs().keySet()) {
|
for (String userId : ipPermission.getTenantIdGroupNamePairs().keySet()) {
|
||||||
for (String groupName : ipPermission.getTenantIdGroupNamePairs().get(userId)) {
|
for (String groupName : ipPermission.getTenantIdGroupNamePairs().get(userId)) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
authorizeSecurityGroupIngressInRegion(region,
|
authorizeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
new UserIdGroupPair(userId, groupName));
|
new UserIdGroupPair(userId, groupName));
|
||||||
|
@ -235,7 +235,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
if (Iterables.size(ipRanges) > 0) {
|
if (Iterables.size(ipRanges) > 0) {
|
||||||
for (String cidr : ipRanges) {
|
for (String cidr : ipRanges) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
authorizeSecurityGroupIngressInRegion(region,
|
authorizeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
protocol,
|
protocol,
|
||||||
|
@ -248,7 +248,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
if (tenantIdGroupNamePairs.size() > 0) {
|
if (tenantIdGroupNamePairs.size() > 0) {
|
||||||
for (String userId : tenantIdGroupNamePairs.keySet()) {
|
for (String userId : tenantIdGroupNamePairs.keySet()) {
|
||||||
for (String groupName : tenantIdGroupNamePairs.get(userId)) {
|
for (String groupName : tenantIdGroupNamePairs.get(userId)) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
authorizeSecurityGroupIngressInRegion(region,
|
authorizeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
new UserIdGroupPair(userId, groupName));
|
new UserIdGroupPair(userId, groupName));
|
||||||
|
@ -266,7 +266,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
if (ipPermission.getCidrBlocks().size() > 0) {
|
if (ipPermission.getCidrBlocks().size() > 0) {
|
||||||
for (String cidr : ipPermission.getCidrBlocks()) {
|
for (String cidr : ipPermission.getCidrBlocks()) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
revokeSecurityGroupIngressInRegion(region,
|
revokeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
ipPermission.getIpProtocol(),
|
ipPermission.getIpProtocol(),
|
||||||
|
@ -279,7 +279,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
if (ipPermission.getTenantIdGroupNamePairs().size() > 0) {
|
if (ipPermission.getTenantIdGroupNamePairs().size() > 0) {
|
||||||
for (String userId : ipPermission.getTenantIdGroupNamePairs().keySet()) {
|
for (String userId : ipPermission.getTenantIdGroupNamePairs().keySet()) {
|
||||||
for (String groupName : ipPermission.getTenantIdGroupNamePairs().get(userId)) {
|
for (String groupName : ipPermission.getTenantIdGroupNamePairs().get(userId)) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
revokeSecurityGroupIngressInRegion(region,
|
revokeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
new UserIdGroupPair(userId, groupName));
|
new UserIdGroupPair(userId, groupName));
|
||||||
|
@ -300,7 +300,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
if (Iterables.size(ipRanges) > 0) {
|
if (Iterables.size(ipRanges) > 0) {
|
||||||
for (String cidr : ipRanges) {
|
for (String cidr : ipRanges) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
revokeSecurityGroupIngressInRegion(region,
|
revokeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
protocol,
|
protocol,
|
||||||
|
@ -313,7 +313,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
if (tenantIdGroupNamePairs.size() > 0) {
|
if (tenantIdGroupNamePairs.size() > 0) {
|
||||||
for (String userId : tenantIdGroupNamePairs.keySet()) {
|
for (String userId : tenantIdGroupNamePairs.keySet()) {
|
||||||
for (String groupName : tenantIdGroupNamePairs.get(userId)) {
|
for (String groupName : tenantIdGroupNamePairs.get(userId)) {
|
||||||
client.getSecurityGroupServices().
|
client.getSecurityGroupApi().get().
|
||||||
revokeSecurityGroupIngressInRegion(region,
|
revokeSecurityGroupIngressInRegion(region,
|
||||||
name,
|
name,
|
||||||
new UserIdGroupPair(userId, groupName));
|
new UserIdGroupPair(userId, groupName));
|
||||||
|
@ -356,7 +356,7 @@ public class EC2SecurityGroupExtension implements SecurityGroupExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<? extends org.jclouds.ec2.domain.SecurityGroup> apply(String from) {
|
public Set<? extends org.jclouds.ec2.domain.SecurityGroup> apply(String from) {
|
||||||
return client.getSecurityGroupServices().describeSecurityGroupsInRegion(from);
|
return client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.KeyPair;
|
import org.jclouds.ec2.domain.KeyPair;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -42,12 +42,12 @@ public class CreateUniqueKeyPair implements Function<RegionAndName, KeyPair> {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
protected final EC2Client ec2Client;
|
protected final EC2Api ec2Api;
|
||||||
protected final GroupNamingConvention.Factory namingConvention;
|
protected final GroupNamingConvention.Factory namingConvention;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CreateUniqueKeyPair(EC2Client ec2Client, GroupNamingConvention.Factory namingConvention) {
|
public CreateUniqueKeyPair(EC2Api ec2Api, GroupNamingConvention.Factory namingConvention) {
|
||||||
this.ec2Client = ec2Client;
|
this.ec2Api = ec2Api;
|
||||||
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class CreateUniqueKeyPair implements Function<RegionAndName, KeyPair> {
|
||||||
while (keyPair == null) {
|
while (keyPair == null) {
|
||||||
String keyName = namingConvention.create().uniqueNameForGroup(prefix);
|
String keyName = namingConvention.create().uniqueNameForGroup(prefix);
|
||||||
try {
|
try {
|
||||||
keyPair = ec2Client.getKeyPairServices().createKeyPairInRegion(region, keyName);
|
keyPair = ec2Api.getKeyPairApi().get().createKeyPairInRegion(region, keyName);
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
logger.trace(" invalid keyname (%s in %s); retrying", keyName, region);
|
logger.trace(" invalid keyname (%s in %s); retrying", keyName, region);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
|
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.KeyPair;
|
import org.jclouds.ec2.domain.KeyPair;
|
||||||
|
@ -59,20 +59,20 @@ public class PasswordCredentialsFromWindowsInstance implements Function<RunningI
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
|
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
|
||||||
private final EC2Client ec2Client;
|
private final EC2Api ec2Api;
|
||||||
private final Function<PasswordDataAndPrivateKey, LoginCredentials> pwDataToLoginCredentials;
|
private final Function<PasswordDataAndPrivateKey, LoginCredentials> pwDataToLoginCredentials;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected PasswordCredentialsFromWindowsInstance(ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
|
protected PasswordCredentialsFromWindowsInstance(ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
|
||||||
EC2Client ec2Client, Function<PasswordDataAndPrivateKey, LoginCredentials> pwDataToLoginCredentials) {
|
EC2Api ec2Api, Function<PasswordDataAndPrivateKey, LoginCredentials> pwDataToLoginCredentials) {
|
||||||
this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
|
this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
|
||||||
this.ec2Client = checkNotNull(ec2Client, "ec2Client");
|
this.ec2Api = checkNotNull(ec2Api, "ec2Api");
|
||||||
this.pwDataToLoginCredentials = checkNotNull(pwDataToLoginCredentials, "pwDataToLoginCredentials");
|
this.pwDataToLoginCredentials = checkNotNull(pwDataToLoginCredentials, "pwDataToLoginCredentials");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginCredentials apply(final RunningInstance instance) {
|
public LoginCredentials apply(final RunningInstance instance) {
|
||||||
Optional<? extends WindowsApi> windowsOption = ec2Client.getWindowsApiForRegion(instance.getRegion());
|
Optional<? extends WindowsApi> windowsOption = ec2Api.getWindowsApiForRegion(instance.getRegion());
|
||||||
checkState(windowsOption.isPresent(), "windows feature not present in region %s", instance.getRegion());
|
checkState(windowsOption.isPresent(), "windows feature not present in region %s", instance.getRegion());
|
||||||
|
|
||||||
final WindowsApi windowsApi = windowsOption.get();
|
final WindowsApi windowsApi = windowsOption.get();
|
||||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Set;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -53,10 +53,10 @@ public class PresentInstances implements Function<Set<RegionAndName>, Set<Runnin
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PresentInstances(EC2Client client) {
|
public PresentInstances(EC2Api client) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class PresentInstances implements Function<Set<RegionAndName>, Set<Runnin
|
||||||
String region = entry.getKey();
|
String region = entry.getKey();
|
||||||
Collection<String> instanceIds = entry.getValue();
|
Collection<String> instanceIds = entry.getValue();
|
||||||
logger.trace("looking for instances %s in region %s", instanceIds, region);
|
logger.trace("looking for instances %s in region %s", instanceIds, region);
|
||||||
builder.addAll(concat(client.getInstanceServices().describeInstancesInRegion(region,
|
builder.addAll(concat(client.getInstanceApi().get().describeInstancesInRegion(region,
|
||||||
toArray(instanceIds, String.class))));
|
toArray(instanceIds, String.class))));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
|
@ -24,11 +24,11 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
||||||
import org.jclouds.ec2.domain.UserIdGroupPair;
|
import org.jclouds.ec2.domain.UserIdGroupPair;
|
||||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
import org.jclouds.ec2.features.SecurityGroupApi;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.net.domain.IpProtocol;
|
import org.jclouds.net.domain.IpProtocol;
|
||||||
|
|
||||||
|
@ -45,16 +45,16 @@ public class CreateSecurityGroupIfNeeded extends CacheLoader<RegionAndName, Stri
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
protected final SecurityGroupClient securityClient;
|
protected final SecurityGroupApi securityClient;
|
||||||
protected final Predicate<RegionAndName> securityGroupEventualConsistencyDelay;
|
protected final Predicate<RegionAndName> securityGroupEventualConsistencyDelay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CreateSecurityGroupIfNeeded(EC2Client ec2Client,
|
public CreateSecurityGroupIfNeeded(EC2Api ec2Api,
|
||||||
@Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
|
@Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
|
||||||
this(checkNotNull(ec2Client, "ec2Client").getSecurityGroupServices(), securityGroupEventualConsistencyDelay);
|
this(checkNotNull(ec2Api, "ec2Api").getSecurityGroupApi().get(), securityGroupEventualConsistencyDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateSecurityGroupIfNeeded(SecurityGroupClient securityClient,
|
public CreateSecurityGroupIfNeeded(SecurityGroupApi securityClient,
|
||||||
@Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
|
@Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
|
||||||
this.securityClient = checkNotNull(securityClient, "securityClient");
|
this.securityClient = checkNotNull(securityClient, "securityClient");
|
||||||
this.securityGroupEventualConsistencyDelay = checkNotNull(securityGroupEventualConsistencyDelay,
|
this.securityGroupEventualConsistencyDelay = checkNotNull(securityGroupEventualConsistencyDelay,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.NoSuchElementException;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
||||||
|
|
||||||
|
@ -34,17 +34,17 @@ import com.google.common.collect.Iterables;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class LoadPublicIpForInstanceOrNull extends CacheLoader<RegionAndName, String> {
|
public class LoadPublicIpForInstanceOrNull extends CacheLoader<RegionAndName, String> {
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public LoadPublicIpForInstanceOrNull(EC2Client client) {
|
public LoadPublicIpForInstanceOrNull(EC2Api client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String load(final RegionAndName key) throws Exception {
|
public String load(final RegionAndName key) throws Exception {
|
||||||
try {
|
try {
|
||||||
return Iterables.find(client.getElasticIPAddressServices().describeAddressesInRegion(key.getRegion()),
|
return Iterables.find(client.getElasticIPAddressApi().get().describeAddressesInRegion(key.getRegion()),
|
||||||
new Predicate<PublicIpInstanceIdPair>() {
|
new Predicate<PublicIpInstanceIdPair>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.functions.EC2ImageParser;
|
import org.jclouds.ec2.compute.functions.EC2ImageParser;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -43,10 +43,10 @@ public class RegionAndIdToImage extends CacheLoader<RegionAndName, Image> {
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final EC2ImageParser parser;
|
private final EC2ImageParser parser;
|
||||||
private final EC2Client sync;
|
private final EC2Api sync;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RegionAndIdToImage(EC2ImageParser parser, EC2Client sync) {
|
public RegionAndIdToImage(EC2ImageParser parser, EC2Api sync) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
this.sync = sync;
|
this.sync = sync;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class RegionAndIdToImage extends CacheLoader<RegionAndName, Image> {
|
||||||
@Override
|
@Override
|
||||||
public Image load(RegionAndName key) throws ExecutionException{
|
public Image load(RegionAndName key) throws ExecutionException{
|
||||||
try {
|
try {
|
||||||
org.jclouds.ec2.domain.Image image = Iterables.getOnlyElement(sync.getAMIServices()
|
org.jclouds.ec2.domain.Image image = Iterables.getOnlyElement(sync.getAMIApi().get()
|
||||||
.describeImagesInRegion(key.getRegion(), imageIds(key.getName())));
|
.describeImagesInRegion(key.getRegion(), imageIds(key.getName())));
|
||||||
return parser.apply(image);
|
return parser.apply(image);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.NoSuchElementException;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.SecurityGroup;
|
import org.jclouds.ec2.domain.SecurityGroup;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -40,13 +40,13 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SecurityGroupPresent implements Predicate<RegionAndName> {
|
public class SecurityGroupPresent implements Predicate<RegionAndName> {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SecurityGroupPresent(EC2Client client) {
|
public SecurityGroupPresent(EC2Api client) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class SecurityGroupPresent implements Predicate<RegionAndName> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SecurityGroup refresh(RegionAndName securityGroup) {
|
protected SecurityGroup refresh(RegionAndName securityGroup) {
|
||||||
return Iterables.getOnlyElement(client.getSecurityGroupServices().describeSecurityGroupsInRegion(
|
return Iterables.getOnlyElement(client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(
|
||||||
securityGroup.getRegion(), securityGroup.getName()));
|
securityGroup.getRegion(), securityGroup.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,14 @@
|
||||||
package org.jclouds.ec2.compute.strategy;
|
package org.jclouds.ec2.compute.strategy;
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.concat;
|
import static com.google.common.collect.Iterables.concat;
|
||||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
|
import static com.google.common.util.concurrent.Futures.allAsList;
|
||||||
|
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -29,7 +33,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.ec2.EC2AsyncClient;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.options.DescribeImagesOptions;
|
import org.jclouds.ec2.options.DescribeImagesOptions;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
|
@ -48,25 +52,35 @@ public class DescribeImagesParallel implements
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
protected final EC2AsyncClient async;
|
protected final EC2Api api;
|
||||||
final ListeningExecutorService userExecutor;
|
final ListeningExecutorService userExecutor;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DescribeImagesParallel(EC2AsyncClient async, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
public DescribeImagesParallel(EC2Api api, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||||
this.async = async;
|
this.api = api;
|
||||||
this.userExecutor = userExecutor;
|
this.userExecutor = userExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends org.jclouds.ec2.domain.Image> apply(
|
public Iterable<? extends org.jclouds.ec2.domain.Image> apply(
|
||||||
Iterable<Entry<String, DescribeImagesOptions>> queries) {
|
final Iterable<Entry<String, DescribeImagesOptions>> queries) {
|
||||||
return concat(transformParallel(
|
ListenableFuture<List<Set<? extends org.jclouds.ec2.domain.Image>>> futures
|
||||||
queries,
|
= allAsList(transform(
|
||||||
new Function<Entry<String, DescribeImagesOptions>, ListenableFuture<? extends Set<? extends org.jclouds.ec2.domain.Image>>>() {
|
queries,
|
||||||
public ListenableFuture<Set<? extends org.jclouds.ec2.domain.Image>> apply(
|
new Function<Entry<String, DescribeImagesOptions>,
|
||||||
Entry<String, DescribeImagesOptions> from) {
|
ListenableFuture<? extends Set<? extends org.jclouds.ec2.domain.Image>>>() {
|
||||||
return async.getAMIServices().describeImagesInRegion(from.getKey(), from.getValue());
|
public ListenableFuture<Set<? extends org.jclouds.ec2.domain.Image>> apply(
|
||||||
}
|
final Entry<String, DescribeImagesOptions> from) {
|
||||||
}, userExecutor, null, logger, "amis"));
|
return userExecutor.submit(new Callable<Set<? extends org.jclouds.ec2.domain.Image>>() {
|
||||||
|
@Override
|
||||||
|
public Set<? extends org.jclouds.ec2.domain.Image> call() throws Exception {
|
||||||
|
return api.getAMIApi().get().describeImagesInRegion(from.getKey(), from.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
logger.trace("amis");
|
||||||
|
|
||||||
|
return concat(getUnchecked(futures));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
|
||||||
import org.jclouds.compute.util.ComputeUtils;
|
import org.jclouds.compute.util.ComputeUtils;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.functions.PresentInstances;
|
import org.jclouds.ec2.compute.functions.PresentInstances;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
|
@ -82,7 +82,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
||||||
boolean autoAllocateElasticIps = false;
|
boolean autoAllocateElasticIps = false;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final EC2Client client;
|
final EC2Api client;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
|
final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -99,7 +99,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2CreateNodesInGroupThenAddToSet(
|
protected EC2CreateNodesInGroupThenAddToSet(
|
||||||
EC2Client client,
|
EC2Api client,
|
||||||
@Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache,
|
@Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache,
|
||||||
@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
|
@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
|
||||||
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
|
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
|
||||||
|
@ -191,7 +191,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
||||||
RunningInstance instance = entry.getValue();
|
RunningInstance instance = entry.getValue();
|
||||||
try {
|
try {
|
||||||
logger.debug("<< allocating elastic IP instance(%s)", id);
|
logger.debug("<< allocating elastic IP instance(%s)", id);
|
||||||
String ip = client.getElasticIPAddressServices().allocateAddressInRegion(id.getRegion());
|
String ip = client.getElasticIPAddressApi().get().allocateAddressInRegion(id.getRegion());
|
||||||
// block until instance is running
|
// block until instance is running
|
||||||
logger.debug(">> awaiting status running instance(%s)", id);
|
logger.debug(">> awaiting status running instance(%s)", id);
|
||||||
AtomicReference<NodeMetadata> node = newReference(runningInstanceToNodeMetadata
|
AtomicReference<NodeMetadata> node = newReference(runningInstanceToNodeMetadata
|
||||||
|
@ -199,7 +199,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
||||||
nodeRunning.apply(node);
|
nodeRunning.apply(node);
|
||||||
logger.trace("<< running instance(%s)", id);
|
logger.trace("<< running instance(%s)", id);
|
||||||
logger.debug(">> associating elastic IP %s to instance %s", ip, id);
|
logger.debug(">> associating elastic IP %s to instance %s", ip, id);
|
||||||
client.getElasticIPAddressServices().associateAddressInRegion(id.getRegion(), ip, id.getName());
|
client.getElasticIPAddressApi().get().associateAddressInRegion(id.getRegion(), ip, id.getName());
|
||||||
logger.trace("<< associated elastic IP %s to instance %s", ip, id);
|
logger.trace("<< associated elastic IP %s to instance %s", ip, id);
|
||||||
// add mapping of instance to ip into the cache
|
// add mapping of instance to ip into the cache
|
||||||
elasticIpCache.put(id, ip);
|
elasticIpCache.put(id, ip);
|
||||||
|
@ -231,7 +231,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
||||||
|
|
||||||
started = ImmutableSet.copyOf(concat(
|
started = ImmutableSet.copyOf(concat(
|
||||||
started,
|
started,
|
||||||
client.getInstanceServices().runInstancesInRegion(region, zone, template.getImage().getProviderId(), 1,
|
client.getInstanceApi().get().runInstancesInRegion(region, zone, template.getImage().getProviderId(), 1,
|
||||||
count - countStarted, instanceOptions)));
|
count - countStarted, instanceOptions)));
|
||||||
|
|
||||||
countStarted = size(started);
|
countStarted = size(started);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.reference.EC2Constants;
|
import org.jclouds.ec2.reference.EC2Constants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -48,7 +48,7 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
protected final EC2Client client;
|
protected final EC2Api client;
|
||||||
protected final GetNodeMetadataStrategy getNode;
|
protected final GetNodeMetadataStrategy getNode;
|
||||||
protected final LoadingCache<RegionAndName, String> elasticIpCache;
|
protected final LoadingCache<RegionAndName, String> elasticIpCache;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy {
|
||||||
boolean autoAllocateElasticIps = false;
|
boolean autoAllocateElasticIps = false;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2DestroyNodeStrategy(EC2Client client, GetNodeMetadataStrategy getNode,
|
protected EC2DestroyNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode,
|
||||||
@Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache) {
|
@Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
this.getNode = checkNotNull(getNode, "getNode");
|
this.getNode = checkNotNull(getNode, "getNode");
|
||||||
|
@ -83,11 +83,11 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy {
|
||||||
try {
|
try {
|
||||||
String ip = elasticIpCache.get(new RegionAndName(region, instanceId));
|
String ip = elasticIpCache.get(new RegionAndName(region, instanceId));
|
||||||
logger.debug(">> disassociating elastic IP %s", ip);
|
logger.debug(">> disassociating elastic IP %s", ip);
|
||||||
client.getElasticIPAddressServices().disassociateAddressInRegion(region, ip);
|
client.getElasticIPAddressApi().get().disassociateAddressInRegion(region, ip);
|
||||||
logger.trace("<< disassociated elastic IP %s", ip);
|
logger.trace("<< disassociated elastic IP %s", ip);
|
||||||
elasticIpCache.invalidate(new RegionAndName(region, instanceId));
|
elasticIpCache.invalidate(new RegionAndName(region, instanceId));
|
||||||
logger.debug(">> releasing elastic IP %s", ip);
|
logger.debug(">> releasing elastic IP %s", ip);
|
||||||
client.getElasticIPAddressServices().releaseAddressInRegion(region, ip);
|
client.getElasticIPAddressApi().get().releaseAddressInRegion(region, ip);
|
||||||
logger.trace("<< released elastic IP %s", ip);
|
logger.trace("<< released elastic IP %s", ip);
|
||||||
} catch (CacheLoader.InvalidCacheLoadException e) {
|
} catch (CacheLoader.InvalidCacheLoadException e) {
|
||||||
// no ip was found
|
// no ip was found
|
||||||
|
@ -100,6 +100,6 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void destroyInstanceInRegion(String instanceId, String region) {
|
protected void destroyInstanceInRegion(String instanceId, String region) {
|
||||||
client.getInstanceServices().terminateInstancesInRegion(region, instanceId);
|
client.getInstanceApi().get().terminateInstancesInRegion(region, instanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.util.AWSUtils;
|
import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.compute.strategy.GetImageStrategy;
|
import org.jclouds.compute.strategy.GetImageStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.Image;
|
import org.jclouds.ec2.domain.Image;
|
||||||
import org.jclouds.ec2.options.DescribeImagesOptions;
|
import org.jclouds.ec2.options.DescribeImagesOptions;
|
||||||
|
|
||||||
|
@ -39,11 +39,11 @@ import com.google.common.base.Function;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EC2GetImageStrategy implements GetImageStrategy {
|
public class EC2GetImageStrategy implements GetImageStrategy {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
private final Function<Image, org.jclouds.compute.domain.Image> imageToImage;
|
private final Function<Image, org.jclouds.compute.domain.Image> imageToImage;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2GetImageStrategy(EC2Client client, Function<Image, org.jclouds.compute.domain.Image> imageToImage) {
|
protected EC2GetImageStrategy(EC2Api client, Function<Image, org.jclouds.compute.domain.Image> imageToImage) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
this.imageToImage = checkNotNull(imageToImage, "imageToImage");
|
this.imageToImage = checkNotNull(imageToImage, "imageToImage");
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class EC2GetImageStrategy implements GetImageStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getImageInRegion(String region, String id) {
|
public Image getImageInRegion(String region, String id) {
|
||||||
return getOnlyElement(client.getAMIServices().describeImagesInRegion(region,
|
return getOnlyElement(client.getAMIApi().get().describeImagesInRegion(region,
|
||||||
DescribeImagesOptions.Builder.imageIds(id)));
|
DescribeImagesOptions.Builder.imageIds(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.aws.util.AWSUtils;
|
import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -40,11 +40,11 @@ import com.google.common.collect.Iterables;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EC2GetNodeMetadataStrategy implements GetNodeMetadataStrategy {
|
public class EC2GetNodeMetadataStrategy implements GetNodeMetadataStrategy {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
private final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
|
private final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2GetNodeMetadataStrategy(EC2Client client,
|
protected EC2GetNodeMetadataStrategy(EC2Api client,
|
||||||
Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata) {
|
Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
this.runningInstanceToNodeMetadata = checkNotNull(runningInstanceToNodeMetadata, "runningInstanceToNodeMetadata");
|
this.runningInstanceToNodeMetadata = checkNotNull(runningInstanceToNodeMetadata, "runningInstanceToNodeMetadata");
|
||||||
|
@ -65,7 +65,7 @@ public class EC2GetNodeMetadataStrategy implements GetNodeMetadataStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RunningInstance getRunningInstanceInRegion(String region, String id) {
|
public RunningInstance getRunningInstanceInRegion(String region, String id) {
|
||||||
return getOnlyElement(Iterables.concat(client.getInstanceServices().describeInstancesInRegion(region, id)));
|
return getOnlyElement(Iterables.concat(client.getInstanceApi().get().describeInstancesInRegion(region, id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.predicates.NodePredicates;
|
import org.jclouds.compute.predicates.NodePredicates;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.compute.strategy.ListNodesStrategy;
|
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
|
@ -73,13 +73,13 @@ public class EC2ListNodesStrategy implements ListNodesStrategy {
|
||||||
@Named(Constants.PROPERTY_REQUEST_TIMEOUT)
|
@Named(Constants.PROPERTY_REQUEST_TIMEOUT)
|
||||||
protected static Long maxTime;
|
protected static Long maxTime;
|
||||||
|
|
||||||
protected final EC2Client client;
|
protected final EC2Api client;
|
||||||
protected final Supplier<Set<String>> regions;
|
protected final Supplier<Set<String>> regions;
|
||||||
protected final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
|
protected final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
|
||||||
protected final ListeningExecutorService userExecutor;
|
protected final ListeningExecutorService userExecutor;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2ListNodesStrategy(EC2Client client, @Region Supplier<Set<String>> regions,
|
protected EC2ListNodesStrategy(EC2Api client, @Region Supplier<Set<String>> regions,
|
||||||
Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
|
Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
|
@ -146,7 +146,7 @@ public class EC2ListNodesStrategy implements ListNodesStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<? extends Reservation<? extends RunningInstance>> apply(String from) {
|
public Set<? extends Reservation<? extends RunningInstance>> apply(String from) {
|
||||||
return client.getInstanceServices().describeInstancesInRegion(from);
|
return client.getInstanceApi().get().describeInstancesInRegion(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -158,7 +158,7 @@ public class EC2ListNodesStrategy implements ListNodesStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<? extends Reservation<? extends RunningInstance>> apply(String from) {
|
public Set<? extends Reservation<? extends RunningInstance>> apply(String from) {
|
||||||
return client.getInstanceServices()
|
return client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(from, toArray(idsByRegions.get(from), String.class));
|
.describeInstancesInRegion(from, toArray(idsByRegions.get(from), String.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -32,12 +32,12 @@ import org.jclouds.ec2.services.InstanceClient;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EC2RebootNodeStrategy implements RebootNodeStrategy {
|
public class EC2RebootNodeStrategy implements RebootNodeStrategy {
|
||||||
private final InstanceClient client;
|
private final InstanceApi client;
|
||||||
private final GetNodeMetadataStrategy getNode;
|
private final GetNodeMetadataStrategy getNode;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2RebootNodeStrategy(EC2Client client, GetNodeMetadataStrategy getNode) {
|
protected EC2RebootNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode) {
|
||||||
this.client = client.getInstanceServices();
|
this.client = client.getInstanceApi().get();
|
||||||
this.getNode = getNode;
|
this.getNode = getNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.compute.strategy.ResumeNodeStrategy;
|
import org.jclouds.compute.strategy.ResumeNodeStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -32,12 +32,12 @@ import org.jclouds.ec2.services.InstanceClient;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EC2ResumeNodeStrategy implements ResumeNodeStrategy {
|
public class EC2ResumeNodeStrategy implements ResumeNodeStrategy {
|
||||||
private final InstanceClient client;
|
private final InstanceApi client;
|
||||||
private final GetNodeMetadataStrategy getNode;
|
private final GetNodeMetadataStrategy getNode;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2ResumeNodeStrategy(EC2Client client, GetNodeMetadataStrategy getNode) {
|
protected EC2ResumeNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode) {
|
||||||
this.client = client.getInstanceServices();
|
this.client = client.getInstanceApi().get();
|
||||||
this.getNode = getNode;
|
this.getNode = getNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -32,12 +32,12 @@ import org.jclouds.ec2.services.InstanceClient;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EC2SuspendNodeStrategy implements SuspendNodeStrategy {
|
public class EC2SuspendNodeStrategy implements SuspendNodeStrategy {
|
||||||
private final InstanceClient client;
|
private final InstanceApi client;
|
||||||
private final GetNodeMetadataStrategy getNode;
|
private final GetNodeMetadataStrategy getNode;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2SuspendNodeStrategy(EC2Client client, GetNodeMetadataStrategy getNode) {
|
protected EC2SuspendNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode) {
|
||||||
this.client = client.getInstanceServices();
|
this.client = client.getInstanceApi().get();
|
||||||
this.getNode = getNode;
|
this.getNode = getNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.ec2.config;
|
||||||
|
|
||||||
|
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||||
|
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.aws.config.FormSigningHttpApiModule;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
|
import org.jclouds.ec2.features.SubnetApi;
|
||||||
|
import org.jclouds.ec2.features.TagApi;
|
||||||
|
import org.jclouds.ec2.features.WindowsApi;
|
||||||
|
import org.jclouds.ec2.features.AMIApi;
|
||||||
|
import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
|
||||||
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
|
import org.jclouds.ec2.features.ElasticIPAddressApi;
|
||||||
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
|
import org.jclouds.ec2.features.KeyPairApi;
|
||||||
|
import org.jclouds.ec2.features.SecurityGroupApi;
|
||||||
|
import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion;
|
||||||
|
import org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs;
|
||||||
|
import org.jclouds.location.config.LocationModule;
|
||||||
|
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
||||||
|
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
||||||
|
import org.jclouds.location.suppliers.RegionIdsSupplier;
|
||||||
|
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
||||||
|
import org.jclouds.location.suppliers.ZoneIdsSupplier;
|
||||||
|
import org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet;
|
||||||
|
import org.jclouds.location.suppliers.derived.ZoneIdToURIFromJoinOnRegionIdToURI;
|
||||||
|
import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues;
|
||||||
|
import org.jclouds.rest.ConfiguresHttpApi;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.reflect.TypeToken;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Scopes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the EC2 connection.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole (EDIT: Nick Terry nterry@familysearch.org)
|
||||||
|
*/
|
||||||
|
@ConfiguresHttpApi
|
||||||
|
public abstract class BaseEC2HttpApiModule<A extends EC2Api> extends
|
||||||
|
FormSigningHttpApiModule<A> {
|
||||||
|
|
||||||
|
protected BaseEC2HttpApiModule(Class<A> api) {
|
||||||
|
super(api);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void installLocations() {
|
||||||
|
install(new LocationModule());
|
||||||
|
bind(RegionIdToZoneIdsSupplier.class).to(DescribeAvailabilityZonesInRegion.class).in(Scopes.SINGLETON);
|
||||||
|
bind(RegionIdToURISupplier.class).to(DescribeRegionsForRegionURIs.class).in(Scopes.SINGLETON);
|
||||||
|
bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON);
|
||||||
|
bind(RegionIdsSupplier.class).to(RegionIdsFromRegionIdToURIKeySet.class).in(Scopes.SINGLETON);
|
||||||
|
bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromJoinOnRegionIdToURI.class).in(Scopes.SINGLETON);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.ec2.config;
|
||||||
|
|
||||||
|
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||||
|
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.aws.config.FormSigningHttpApiModule;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
|
import org.jclouds.ec2.features.SubnetApi;
|
||||||
|
import org.jclouds.ec2.features.TagApi;
|
||||||
|
import org.jclouds.ec2.features.WindowsApi;
|
||||||
|
import org.jclouds.ec2.features.AMIApi;
|
||||||
|
import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
|
||||||
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
|
import org.jclouds.ec2.features.ElasticIPAddressApi;
|
||||||
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
|
import org.jclouds.ec2.features.KeyPairApi;
|
||||||
|
import org.jclouds.ec2.features.SecurityGroupApi;
|
||||||
|
import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion;
|
||||||
|
import org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs;
|
||||||
|
import org.jclouds.location.config.LocationModule;
|
||||||
|
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
||||||
|
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
||||||
|
import org.jclouds.location.suppliers.RegionIdsSupplier;
|
||||||
|
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
||||||
|
import org.jclouds.location.suppliers.ZoneIdsSupplier;
|
||||||
|
import org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet;
|
||||||
|
import org.jclouds.location.suppliers.derived.ZoneIdToURIFromJoinOnRegionIdToURI;
|
||||||
|
import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues;
|
||||||
|
import org.jclouds.rest.ConfiguresHttpApi;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.reflect.TypeToken;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Scopes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the EC2 connection.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole (EDIT: Nick Terry nterry@familysearch.org)
|
||||||
|
*/
|
||||||
|
@ConfiguresHttpApi
|
||||||
|
public class EC2HttpApiModule extends BaseEC2HttpApiModule<EC2Api> {
|
||||||
|
|
||||||
|
public EC2HttpApiModule() {
|
||||||
|
super(EC2Api.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,134 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.config;
|
|
||||||
|
|
||||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.aws.config.WithZonesFormSigningRestClientModule;
|
|
||||||
import org.jclouds.ec2.EC2Api;
|
|
||||||
import org.jclouds.ec2.EC2AsyncApi;
|
|
||||||
import org.jclouds.ec2.EC2AsyncClient;
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.ec2.features.SubnetApi;
|
|
||||||
import org.jclouds.ec2.features.SubnetAsyncApi;
|
|
||||||
import org.jclouds.ec2.features.TagApi;
|
|
||||||
import org.jclouds.ec2.features.TagAsyncApi;
|
|
||||||
import org.jclouds.ec2.features.WindowsApi;
|
|
||||||
import org.jclouds.ec2.features.WindowsAsyncApi;
|
|
||||||
import org.jclouds.ec2.services.AMIAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.AMIClient;
|
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressClient;
|
|
||||||
import org.jclouds.ec2.services.InstanceAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
|
||||||
import org.jclouds.ec2.services.KeyPairAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.KeyPairClient;
|
|
||||||
import org.jclouds.ec2.services.SecurityGroupAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
|
||||||
import org.jclouds.ec2.services.WindowsAsyncClient;
|
|
||||||
import org.jclouds.ec2.services.WindowsClient;
|
|
||||||
import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion;
|
|
||||||
import org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs;
|
|
||||||
import org.jclouds.location.config.LocationModule;
|
|
||||||
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
|
||||||
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
|
||||||
import org.jclouds.location.suppliers.RegionIdsSupplier;
|
|
||||||
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
|
||||||
import org.jclouds.location.suppliers.ZoneIdsSupplier;
|
|
||||||
import org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet;
|
|
||||||
import org.jclouds.location.suppliers.derived.ZoneIdToURIFromJoinOnRegionIdToURI;
|
|
||||||
import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues;
|
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.Scopes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the EC2 connection.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole (EDIT: Nick Terry nterry@familysearch.org)
|
|
||||||
*/
|
|
||||||
@ConfiguresRestClient
|
|
||||||
// EC2Api not EC2Client so that this can be used for new apps that only depend on EC2Api
|
|
||||||
public class EC2RestClientModule<S extends EC2Api, A extends EC2AsyncApi> extends
|
|
||||||
WithZonesFormSigningRestClientModule<S, A> {
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
|
||||||
.put(AMIClient.class, AMIAsyncClient.class)//
|
|
||||||
.put(ElasticIPAddressClient.class, ElasticIPAddressAsyncClient.class)//
|
|
||||||
.put(InstanceClient.class, InstanceAsyncClient.class)//
|
|
||||||
.put(KeyPairClient.class, KeyPairAsyncClient.class)//
|
|
||||||
.put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)//
|
|
||||||
.put(WindowsClient.class, WindowsAsyncClient.class)//
|
|
||||||
.put(AvailabilityZoneAndRegionClient.class, AvailabilityZoneAndRegionAsyncClient.class)//
|
|
||||||
.put(ElasticBlockStoreClient.class, ElasticBlockStoreAsyncClient.class)//
|
|
||||||
.put(WindowsApi.class, WindowsAsyncApi.class)//
|
|
||||||
.put(TagApi.class, TagAsyncApi.class)//
|
|
||||||
.put(SubnetApi.class, SubnetAsyncApi.class)//
|
|
||||||
.build();
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public EC2RestClientModule() {
|
|
||||||
// retaining top-level type of EC2Client vs EC2Api until we migrate all functionality up
|
|
||||||
super(TypeToken.class.cast(typeToken(EC2Client.class)), TypeToken.class.cast(typeToken(EC2AsyncClient.class)), DELEGATE_MAP);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected EC2RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
|
|
||||||
Map<Class<?>, Class<?>> sync2Async) {
|
|
||||||
super(syncClientType, asyncClientType, sync2Async);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* so that we can make bindings to {@link EC2Api directly} until we switch
|
|
||||||
* off {@link @EC2Client}
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
|
||||||
EC2Api provideEC2Api(EC2Client in) {
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* so that we can make bindings to {@link EC2AsyncApi directly} until we switch
|
|
||||||
* off {@link @EC2AsyncClient}
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
|
||||||
EC2AsyncApi provideEC2Api(EC2AsyncClient in) {
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void installLocations() {
|
|
||||||
install(new LocationModule());
|
|
||||||
bind(RegionIdToZoneIdsSupplier.class).to(DescribeAvailabilityZonesInRegion.class).in(Scopes.SINGLETON);
|
|
||||||
bind(RegionIdToURISupplier.class).to(DescribeRegionsForRegionURIs.class).in(Scopes.SINGLETON);
|
|
||||||
bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON);
|
|
||||||
bind(RegionIdsSupplier.class).to(RegionIdsFromRegionIdToURIKeySet.class).in(Scopes.SINGLETON);
|
|
||||||
bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromJoinOnRegionIdToURI.class).in(Scopes.SINGLETON);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,10 +14,22 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
|
||||||
import org.jclouds.ec2.domain.Image;
|
import org.jclouds.ec2.domain.Image;
|
||||||
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
||||||
import org.jclouds.ec2.domain.Permission;
|
import org.jclouds.ec2.domain.Permission;
|
||||||
|
@ -25,15 +37,29 @@ import org.jclouds.ec2.options.CreateImageOptions;
|
||||||
import org.jclouds.ec2.options.DescribeImagesOptions;
|
import org.jclouds.ec2.options.DescribeImagesOptions;
|
||||||
import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions;
|
import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions;
|
||||||
import org.jclouds.ec2.options.RegisterImageOptions;
|
import org.jclouds.ec2.options.RegisterImageOptions;
|
||||||
|
import org.jclouds.ec2.xml.BlockDeviceMappingHandler;
|
||||||
|
import org.jclouds.ec2.xml.DescribeImagesResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.ImageIdHandler;
|
||||||
|
import org.jclouds.ec2.xml.PermissionHandler;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 via their REST API.
|
* Provides access to AMI Services.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface AMIClient {
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
|
public interface AMIApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about AMIs, AKIs, and ARIs. This includes image type, product codes,
|
* Returns information about AMIs, AKIs, and ARIs. This includes image type, product codes,
|
||||||
|
@ -43,29 +69,21 @@ public interface AMIClient {
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* AMIs are tied to the Region where its files are located within Amazon S3.
|
* AMIs are tied to the Region where its files are located within Amazon S3.
|
||||||
* @see InstanceClient#describeInstances
|
* @see InstanceApi#describeInstances
|
||||||
* @see #describeImageAttribute
|
* @see #describeImageAttribute
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
||||||
* />
|
* />
|
||||||
* @see DescribeImagesOptions
|
* @see DescribeImagesOptions
|
||||||
*/
|
*/
|
||||||
Set<? extends Image> describeImagesInRegion(@Nullable String region, DescribeImagesOptions... options);
|
@Named("DescribeImages")
|
||||||
|
@POST
|
||||||
/**
|
@Path("/")
|
||||||
* Returns a map of device name to block device for the image.
|
@FormParams(keys = ACTION, values = "DescribeImages")
|
||||||
*
|
@XMLResponseParser(DescribeImagesResponseHandler.class)
|
||||||
* @param region
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
* AMIs are tied to the Region where its files are located within Amazon S3.
|
Set<? extends Image> describeImagesInRegion(
|
||||||
* @param imageId
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
* The ID of the AMI for which an attribute will be described
|
DescribeImagesOptions... options);
|
||||||
* @see #describeImages
|
|
||||||
* @see #modifyImageAttribute
|
|
||||||
* @see #resetImageAttribute
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImageAttribute.html"
|
|
||||||
* />
|
|
||||||
* @see DescribeImagesOptions
|
|
||||||
*/
|
|
||||||
Map<String, EbsBlockDevice> getBlockDeviceMappingsForImageInRegion(@Nullable String region, String imageId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance.
|
* Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance.
|
||||||
|
@ -82,14 +100,21 @@ public interface AMIClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
||||||
* />
|
* />
|
||||||
* @see CreateImageOptions
|
* @see CreateImageOptions
|
||||||
* @see InstanceClient#runInstances
|
* @see InstanceApi#runInstances
|
||||||
* @see InstanceClient#describeInstances
|
* @see InstanceApi#describeInstances
|
||||||
* @see InstanceClient#terminateInstances
|
* @see InstanceApi#terminateInstances
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateImage.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateImage.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
String createImageInRegion(@Nullable String region, String name, String instanceId, CreateImageOptions... options);
|
@Named("CreateImage")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateImage")
|
||||||
|
@XMLResponseParser(ImageIdHandler.class)
|
||||||
|
String createImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("Name") String name, @FormParam("InstanceId") String instanceId, CreateImageOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -108,11 +133,17 @@ public interface AMIClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void deregisterImageInRegion(@Nullable String region, String imageId);
|
@Named("DeregisterImage")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DeregisterImage")
|
||||||
|
void deregisterImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("ImageId") String imageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To
|
* Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To
|
||||||
* launch instances, use the {@link InstanceClient#runInstances} operation.
|
* launch instances, use the {@link InstanceApi#runInstances} operation.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through
|
* Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through
|
||||||
* this operation. If needed, you can deregister an AMI at any time.
|
* this operation. If needed, you can deregister an AMI at any time.
|
||||||
|
@ -138,12 +169,19 @@ public interface AMIClient {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
String registerImageFromManifestInRegion(@Nullable String region, String name, String pathToManifest,
|
@Named("RegisterImage")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "RegisterImage")
|
||||||
|
@XMLResponseParser(ImageIdHandler.class)
|
||||||
|
String registerImageFromManifestInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest,
|
||||||
RegisterImageOptions... options);
|
RegisterImageOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To
|
* Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To
|
||||||
* launch instances, use the {@link InstanceClient#runInstances} operation. The root device name
|
* launch instances, use the {@link InstanceApi#runInstances} operation. The root device name
|
||||||
* is /dev/sda1
|
* is /dev/sda1
|
||||||
* <p/>
|
* <p/>
|
||||||
* Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through
|
* Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through
|
||||||
|
@ -173,24 +211,39 @@ public interface AMIClient {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
String registerUnixImageBackedByEbsInRegion(@Nullable String region, String name, String ebsSnapshotId,
|
@Named("RegisterImage")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "RootDeviceName", "BlockDeviceMapping.0.DeviceName" }, values = { "RegisterImage",
|
||||||
|
"/dev/sda1", "/dev/sda1" })
|
||||||
|
@XMLResponseParser(ImageIdHandler.class)
|
||||||
|
String registerUnixImageBackedByEbsInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("Name") String imageName,
|
||||||
|
@FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId,
|
||||||
RegisterImageBackedByEbsOptions... options);
|
RegisterImageBackedByEbsOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Permission}s of an image.
|
* Resets the {@code launchPermission}s on an AMI.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* AMIs are tied to the Region where its files are located within Amazon S3.
|
* AMIs are tied to the Region where its files are located within Amazon S3.
|
||||||
* @param imageId
|
* @param imageId
|
||||||
* The ID of the AMI for which an attribute will be described
|
* ID of the AMI on which the attribute will be reset.
|
||||||
* @see #describeImages
|
*
|
||||||
* @see #modifyImageAttribute
|
* @see #addLaunchPermissionsToImage
|
||||||
* @see #resetImageAttribute
|
* @see #describeImageAttribute
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImageAttribute.html"
|
* @see #removeProductCodesFromImage
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetImageAttribute.html"
|
||||||
* />
|
* />
|
||||||
* @see DescribeImagesOptions
|
|
||||||
*/
|
*/
|
||||||
Permission getLaunchPermissionForImageInRegion(@Nullable String region, String imageId);
|
@Named("ResetImageAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" })
|
||||||
|
void resetLaunchPermissionsOnImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("ImageId") String imageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds {@code launchPermission}s to an AMI.
|
* Adds {@code launchPermission}s to an AMI.
|
||||||
|
@ -210,44 +263,74 @@ public interface AMIClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void addLaunchPermissionsToImageInRegion(@Nullable String region, Iterable<String> userIds,
|
@Named("ModifyImageAttribute")
|
||||||
Iterable<String> userGroups, String imageId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "add",
|
||||||
|
"launchPermission" })
|
||||||
|
void addLaunchPermissionsToImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||||
|
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||||
|
@FormParam("ImageId") String imageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the {@code launchPermission}s on an AMI.
|
* @see AMIApi#removeLaunchPermissionsToImageInRegion
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* AMIs are tied to the Region where its files are located within Amazon S3.
|
|
||||||
* @param imageId
|
|
||||||
* ID of the AMI on which the attribute will be reset.
|
|
||||||
*
|
|
||||||
* @see #addLaunchPermissionsToImage
|
|
||||||
* @see #describeImageAttribute
|
|
||||||
* @see #removeProductCodesFromImage
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetImageAttribute.html"
|
|
||||||
* />
|
|
||||||
*/
|
*/
|
||||||
void resetLaunchPermissionsOnImageInRegion(@Nullable String region, String imageId);
|
@Named("ModifyImageAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "remove",
|
||||||
|
"launchPermission" })
|
||||||
|
void removeLaunchPermissionsFromImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||||
|
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||||
|
@FormParam("ImageId") String imageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes {@code launchPermission}s from an AMI.
|
* Returns the {@link Permission}s of an image.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* AMIs are tied to the Region where its files are located within Amazon S3.
|
* AMIs are tied to the Region where its files are located within Amazon S3.
|
||||||
* @param userIds
|
|
||||||
* AWS Access Key ID.
|
|
||||||
* @param userGroups
|
|
||||||
* Name of the groups. Currently supports \"all.\""
|
|
||||||
* @param imageId
|
* @param imageId
|
||||||
* The AMI ID.
|
* The ID of the AMI for which an attribute will be described
|
||||||
*
|
* @see #describeImages
|
||||||
* @see #addLaunchPermissionsToImage
|
* @see #modifyImageAttribute
|
||||||
* @see #describeImageAttribute
|
|
||||||
* @see #resetImageAttribute
|
* @see #resetImageAttribute
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImageAttribute.html"
|
||||||
* />
|
* />
|
||||||
|
* @see DescribeImagesOptions
|
||||||
*/
|
*/
|
||||||
void removeLaunchPermissionsFromImageInRegion(@Nullable String region, Iterable<String> userIds,
|
@Named("DescribeImageAttribute")
|
||||||
Iterable<String> userGroups, String imageId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "launchPermission" })
|
||||||
|
@XMLResponseParser(PermissionHandler.class)
|
||||||
|
Permission getLaunchPermissionForImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("ImageId") String imageId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of device name to block device for the image.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* AMIs are tied to the Region where its files are located within Amazon S3.
|
||||||
|
* @param imageId
|
||||||
|
* The ID of the AMI for which an attribute will be described
|
||||||
|
* @see #describeImages
|
||||||
|
* @see #modifyImageAttribute
|
||||||
|
* @see #resetImageAttribute
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImageAttribute.html"
|
||||||
|
* />
|
||||||
|
* @see DescribeImagesOptions
|
||||||
|
*/
|
||||||
|
@Named("DescribeImageAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "blockDeviceMapping" })
|
||||||
|
@XMLResponseParser(BlockDeviceMappingHandler.class)
|
||||||
|
Map<String, EbsBlockDevice> getBlockDeviceMappingsForImageInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("ImageId") String imageId);
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 Availability Zones and Regions via their REST API.
|
* Provides access to EC2 Availability Zones and Regions via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -52,10 +50,16 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@RequestFilters(FormSigner.class)
|
@RequestFilters(FormSigner.class)
|
||||||
@VirtualHost
|
@VirtualHost
|
||||||
public interface AvailabilityZoneAndRegionAsyncClient {
|
public interface AvailabilityZoneAndRegionApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AvailabilityZoneAndRegionClient#describeAvailabilityZonesInRegion
|
* Displays Availability Zones that are currently available to the identity and their states.
|
||||||
|
*
|
||||||
|
* @see InstanceApi#runInstances
|
||||||
|
* @see #describeRegions
|
||||||
|
*
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html"
|
||||||
|
* />
|
||||||
*/
|
*/
|
||||||
@Named("DescribeAvailabilityZones")
|
@Named("DescribeAvailabilityZones")
|
||||||
@POST
|
@POST
|
||||||
|
@ -63,18 +67,24 @@ public interface AvailabilityZoneAndRegionAsyncClient {
|
||||||
@FormParams(keys = ACTION, values = "DescribeAvailabilityZones")
|
@FormParams(keys = ACTION, values = "DescribeAvailabilityZones")
|
||||||
@XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class)
|
@XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class)
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<? extends Set<AvailabilityZoneInfo>> describeAvailabilityZonesInRegion(
|
Set<AvailabilityZoneInfo> describeAvailabilityZonesInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
DescribeAvailabilityZonesOptions... options);
|
DescribeAvailabilityZonesOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AvailabilityZoneAndRegionClient#describeRegions
|
* Describes Regions that are currently available to the identity.
|
||||||
|
*
|
||||||
|
* @see InstanceApi#runInstances
|
||||||
|
* @see #describeAvailabilityZones
|
||||||
|
*
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRegions.html"
|
||||||
|
* />
|
||||||
*/
|
*/
|
||||||
@Named("DescribeRegions")
|
@Named("DescribeRegions")
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@FormParams(keys = ACTION, values = "DescribeRegions")
|
@FormParams(keys = ACTION, values = "DescribeRegions")
|
||||||
@XMLResponseParser(DescribeRegionsResponseHandler.class)
|
@XMLResponseParser(DescribeRegionsResponseHandler.class)
|
||||||
ListenableFuture<? extends Map<String, URI>> describeRegions(DescribeRegionsOptions... options);
|
Map<String, URI> describeRegions(DescribeRegionsOptions... options);
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,9 +14,23 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.EC2Fallbacks.VoidOnVolumeAvailable;
|
||||||
|
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindVolumeIdsToIndexedFormParams;
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
import org.jclouds.ec2.domain.Attachment;
|
||||||
import org.jclouds.ec2.domain.Permission;
|
import org.jclouds.ec2.domain.Permission;
|
||||||
import org.jclouds.ec2.domain.Snapshot;
|
import org.jclouds.ec2.domain.Snapshot;
|
||||||
|
@ -24,15 +38,32 @@ import org.jclouds.ec2.domain.Volume;
|
||||||
import org.jclouds.ec2.options.CreateSnapshotOptions;
|
import org.jclouds.ec2.options.CreateSnapshotOptions;
|
||||||
import org.jclouds.ec2.options.DescribeSnapshotsOptions;
|
import org.jclouds.ec2.options.DescribeSnapshotsOptions;
|
||||||
import org.jclouds.ec2.options.DetachVolumeOptions;
|
import org.jclouds.ec2.options.DetachVolumeOptions;
|
||||||
|
import org.jclouds.ec2.xml.AttachmentHandler;
|
||||||
|
import org.jclouds.ec2.xml.CreateVolumeResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.DescribeSnapshotsResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.DescribeVolumesResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.PermissionHandler;
|
||||||
|
import org.jclouds.ec2.xml.SnapshotHandler;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
|
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 Elastic Block Store services.
|
* Provides access to EC2 Elastic Block Store services via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface ElasticBlockStoreClient {
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
|
public interface ElasticBlockStoreApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same
|
* Creates a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same
|
||||||
|
@ -49,15 +80,21 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see #deleteVolumeInRegion
|
* @see #deleteVolumeInRegion
|
||||||
* @see #attachVolumeInRegion
|
* @see #attachVolumeInRegion
|
||||||
* @see #detachVolumeInRegion
|
* @see #detachVolumeInRegion
|
||||||
* @see AvailabilityZoneAndRegionClient#describeAvailabilityZonesInRegion
|
* @see AvailabilityZoneAndRegionApi#describeAvailabilityZonesInRegion
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Volume createVolumeFromSnapshotInAvailabilityZone(String availabilityZone,
|
@Named("CreateVolume")
|
||||||
String snapshotId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateVolume")
|
||||||
|
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
||||||
|
Volume createVolumeFromSnapshotInAvailabilityZone(
|
||||||
|
@EndpointParam(parser = ZoneToEndpoint.class) @FormParam("AvailabilityZone") String availabilityZone,
|
||||||
|
@FormParam("SnapshotId") String snapshotId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same
|
* Creates a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same
|
||||||
|
@ -79,15 +116,21 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see #deleteVolumeInRegion
|
* @see #deleteVolumeInRegion
|
||||||
* @see #attachVolumeInRegion
|
* @see #attachVolumeInRegion
|
||||||
* @see #detachVolumeInRegion
|
* @see #detachVolumeInRegion
|
||||||
* @see AvailabilityZoneAndRegionClient#describeAvailabilityZonesInRegion
|
* @see AvailabilityZoneAndRegionApi#describeAvailabilityZonesInRegion
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Volume createVolumeFromSnapshotInAvailabilityZone(String availabilityZone,
|
@Named("CreateVolume")
|
||||||
int size, String snapshotId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateVolume")
|
||||||
|
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
||||||
|
Volume createVolumeFromSnapshotInAvailabilityZone(
|
||||||
|
@EndpointParam(parser = ZoneToEndpoint.class) @FormParam("AvailabilityZone") String availabilityZone,
|
||||||
|
@FormParam("Size") int size, @FormParam("SnapshotId") String snapshotId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same
|
* Creates a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same
|
||||||
|
@ -106,12 +149,19 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see #deleteVolumeInRegion
|
* @see #deleteVolumeInRegion
|
||||||
* @see #attachVolumeInRegion
|
* @see #attachVolumeInRegion
|
||||||
* @see #detachVolumeInRegion
|
* @see #detachVolumeInRegion
|
||||||
* @see AvailabilityZoneAndRegionClient#describeAvailabilityZonesInRegion
|
* @see AvailabilityZoneAndRegionApi#describeAvailabilityZonesInRegion
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Volume createVolumeInAvailabilityZone(String availabilityZone, int size);
|
@Named("CreateVolume")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateVolume")
|
||||||
|
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
||||||
|
Volume createVolumeInAvailabilityZone(
|
||||||
|
@EndpointParam(parser = ZoneToEndpoint.class) @FormParam("AvailabilityZone") String availabilityZone,
|
||||||
|
@FormParam("Size") int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the specified Amazon EBS volumes that you own. If you do not specify one or more
|
* Describes the specified Amazon EBS volumes that you own. If you do not specify one or more
|
||||||
|
@ -129,7 +179,14 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<Volume> describeVolumesInRegion(@Nullable String region, String... volumeIds);
|
@POST
|
||||||
|
@Named("DescribeVolumes")
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeVolumes")
|
||||||
|
@XMLResponseParser(DescribeVolumesResponseHandler.class)
|
||||||
|
Set<Volume> describeVolumesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindVolumeIdsToIndexedFormParams.class) String... volumeIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an Amazon EBS volume that you own. For more information about Amazon EBS, go to the
|
* Deletes an Amazon EBS volume that you own. For more information about Amazon EBS, go to the
|
||||||
|
@ -150,7 +207,12 @@ public interface ElasticBlockStoreClient {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteVolume.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteVolume.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void deleteVolumeInRegion(@Nullable String region, String volumeId);
|
@Named("DeleteVolume")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DeleteVolume")
|
||||||
|
void deleteVolumeInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("VolumeId") String volumeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches an Amazon EBS volume to a running instance and exposes it as the specified device.
|
* Attaches an Amazon EBS volume to a running instance and exposes it as the specified device.
|
||||||
|
@ -190,8 +252,13 @@ public interface ElasticBlockStoreClient {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DetachVolume.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DetachVolume.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void detachVolumeInRegion(@Nullable String region, String volumeId, boolean force,
|
@Named("DetachVolume")
|
||||||
DetachVolumeOptions... options);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DetachVolume")
|
||||||
|
@Fallback(VoidOnVolumeAvailable.class)
|
||||||
|
void detachVolumeInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force, DetachVolumeOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches an Amazon EBS volume to a running instance and exposes it as the specified device.
|
* Attaches an Amazon EBS volume to a running instance and exposes it as the specified device.
|
||||||
|
@ -223,7 +290,15 @@ public interface ElasticBlockStoreClient {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AttachVolume.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AttachVolume.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Attachment attachVolumeInRegion(@Nullable String region, String volumeId, String instanceId, String device);
|
@Named("AttachVolume")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "AttachVolume")
|
||||||
|
@XMLResponseParser(AttachmentHandler.class)
|
||||||
|
Attachment attachVolumeInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("VolumeId") String volumeId, @FormParam("InstanceId") String instanceId,
|
||||||
|
@FormParam("Device") String device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots
|
* Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots
|
||||||
|
@ -260,7 +335,14 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Snapshot createSnapshotInRegion(@Nullable String region, String volumeId, CreateSnapshotOptions... options);
|
@Named("CreateSnapshot")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateSnapshot")
|
||||||
|
@XMLResponseParser(SnapshotHandler.class)
|
||||||
|
Snapshot createSnapshotInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("VolumeId") String volumeId, CreateSnapshotOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about Amazon EBS snapshots available to the user. Information returned
|
* Returns information about Amazon EBS snapshots available to the user. Information returned
|
||||||
|
@ -321,7 +403,15 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<Snapshot> describeSnapshotsInRegion(@Nullable String region, DescribeSnapshotsOptions... options);
|
@Named("DescribeSnapshots")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeSnapshots")
|
||||||
|
@XMLResponseParser(DescribeSnapshotsResponseHandler.class)
|
||||||
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
|
Set<Snapshot> describeSnapshotsInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
DescribeSnapshotsOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a snapshot of an Amazon EBS volume that you own. For more information, go to the
|
* Deletes a snapshot of an Amazon EBS volume that you own. For more information, go to the
|
||||||
|
@ -338,23 +428,13 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSnapshot.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSnapshot.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void deleteSnapshotInRegion(@Nullable String region, String snapshotId);
|
@Named("DeleteSnapshot")
|
||||||
|
@POST
|
||||||
/**
|
@Path("/")
|
||||||
* Returns the {@link Permission}s of an snapshot.
|
@FormParams(keys = ACTION, values = "DeleteSnapshot")
|
||||||
*
|
void deleteSnapshotInRegion(
|
||||||
* @param region
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
* AMIs are tied to the Region where its files are located within Amazon S3.
|
@FormParam("SnapshotId") String snapshotId);
|
||||||
* @param snapshotId
|
|
||||||
* The ID of the AMI for which an attribute will be described
|
|
||||||
* @see #describeSnapshots
|
|
||||||
* @see #modifySnapshotAttribute
|
|
||||||
* @see #resetSnapshotAttribute
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshotAttribute.html"
|
|
||||||
* />
|
|
||||||
* @see DescribeSnapshotsOptions
|
|
||||||
*/
|
|
||||||
Permission getCreateVolumePermissionForSnapshotInRegion(@Nullable String region, String snapshotId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds {@code createVolumePermission}s to an EBS snapshot.
|
* Adds {@code createVolumePermission}s to an EBS snapshot.
|
||||||
|
@ -375,25 +455,16 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void addCreateVolumePermissionsToSnapshotInRegion(@Nullable String region, Iterable<String> userIds,
|
@Named("ModifySnapshotAttribute")
|
||||||
Iterable<String> userGroups, String snapshotId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
/**
|
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifySnapshotAttribute", "add",
|
||||||
* Resets the {@code createVolumePermission}s on an EBS snapshot.
|
"createVolumePermission" })
|
||||||
*
|
void addCreateVolumePermissionsToSnapshotInRegion(
|
||||||
* @param region
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
* Snapshots are tied to Regions and can only be used for volumes within the same
|
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||||
* Region.
|
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||||
* @param snapshotId
|
@FormParam("SnapshotId") String snapshotId);
|
||||||
* The ID of the Amazon EBS snapshot.
|
|
||||||
*
|
|
||||||
* @see #addCreateVolumePermissionsToSnapshot
|
|
||||||
* @see #describeSnapshotAttribute
|
|
||||||
* @see #removeProductCodesFromSnapshot
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetSnapshotAttribute.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
void resetCreateVolumePermissionsOnSnapshotInRegion(@Nullable String region, String snapshotId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes {@code createVolumePermission}s from an EBS snapshot.
|
* Removes {@code createVolumePermission}s from an EBS snapshot.
|
||||||
|
@ -414,6 +485,61 @@ public interface ElasticBlockStoreClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void removeCreateVolumePermissionsFromSnapshotInRegion(@Nullable String region, Iterable<String> userIds,
|
@Named("ModifySnapshotAttribute")
|
||||||
Iterable<String> userGroups, String snapshotId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifySnapshotAttribute", "remove",
|
||||||
|
"createVolumePermission" })
|
||||||
|
void removeCreateVolumePermissionsFromSnapshotInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||||
|
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||||
|
@FormParam("SnapshotId") String snapshotId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Permission}s of an snapshot.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* AMIs are tied to the Region where its files are located within Amazon S3.
|
||||||
|
* @param snapshotId
|
||||||
|
* The ID of the AMI for which an attribute will be described
|
||||||
|
* @see #describeSnapshots
|
||||||
|
* @see #modifySnapshotAttribute
|
||||||
|
* @see #resetSnapshotAttribute
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshotAttribute.html"
|
||||||
|
* />
|
||||||
|
* @see DescribeSnapshotsOptions
|
||||||
|
*/
|
||||||
|
@Named("DescribeSnapshotAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeSnapshotAttribute", "createVolumePermission" })
|
||||||
|
@XMLResponseParser(PermissionHandler.class)
|
||||||
|
Permission getCreateVolumePermissionForSnapshotInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("SnapshotId") String snapshotId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the {@code createVolumePermission}s on an EBS snapshot.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Snapshots are tied to Regions and can only be used for volumes within the same
|
||||||
|
* Region.
|
||||||
|
* @param snapshotId
|
||||||
|
* The ID of the Amazon EBS snapshot.
|
||||||
|
*
|
||||||
|
* @see #addCreateVolumePermissionsToSnapshot
|
||||||
|
* @see #describeSnapshotAttribute
|
||||||
|
* @see #removeProductCodesFromSnapshot
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetSnapshotAttribute.html"
|
||||||
|
* />
|
||||||
|
*/
|
||||||
|
@Named("ResetSnapshotAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetSnapshotAttribute", "createVolumePermission" })
|
||||||
|
void resetCreateVolumePermissionsOnSnapshotInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("SnapshotId") String snapshotId);
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,19 +14,42 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindPublicIpsToIndexedFormParams;
|
||||||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
||||||
|
import org.jclouds.ec2.xml.AllocateAddressResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.DescribeAddressesResponseHandler;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 via their REST API.
|
* Provides access to EC2 Elastic IP Addresses via REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface ElasticIPAddressClient {
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
|
public interface ElasticIPAddressApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquires an elastic IP address for use with your identity.
|
* Acquires an elastic IP address for use with your identity.
|
||||||
|
@ -39,7 +62,13 @@ public interface ElasticIPAddressClient {
|
||||||
* @see #disassociateAddress
|
* @see #disassociateAddress
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html"
|
||||||
*/
|
*/
|
||||||
String allocateAddressInRegion(@Nullable String region);
|
@Named("AllocateAddress")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@XMLResponseParser(AllocateAddressResponseHandler.class)
|
||||||
|
@FormParams(keys = ACTION, values = "AllocateAddress")
|
||||||
|
String allocateAddressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associates an elastic IP address with an instance. If the IP address is currently assigned to
|
* Associates an elastic IP address with an instance. If the IP address is currently assigned to
|
||||||
|
@ -59,7 +88,13 @@ public interface ElasticIPAddressClient {
|
||||||
* @see #disassociateAddress
|
* @see #disassociateAddress
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-AssociateAddress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-AssociateAddress.html"
|
||||||
*/
|
*/
|
||||||
void associateAddressInRegion(@Nullable String region, String publicIp, String instanceId);
|
@Named("AssociateAddress")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "AssociateAddress")
|
||||||
|
void associateAddressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("PublicIp") String publicIp, @FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disassociates the specified elastic IP address from the instance to which it is assigned. This
|
* Disassociates the specified elastic IP address from the instance to which it is assigned. This
|
||||||
|
@ -77,7 +112,13 @@ public interface ElasticIPAddressClient {
|
||||||
* @see #associateAddress
|
* @see #associateAddress
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DisassociateAddress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DisassociateAddress.html"
|
||||||
*/
|
*/
|
||||||
void disassociateAddressInRegion(@Nullable String region, String publicIp);
|
@Named("DisassociateAddress")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DisassociateAddress")
|
||||||
|
void disassociateAddressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("PublicIp") String publicIp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases an elastic IP address associated with your identity.
|
* Releases an elastic IP address associated with your identity.
|
||||||
|
@ -93,7 +134,13 @@ public interface ElasticIPAddressClient {
|
||||||
* @see #disassociateAddress
|
* @see #disassociateAddress
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-ReleaseAddress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-ReleaseAddress.html"
|
||||||
*/
|
*/
|
||||||
void releaseAddressInRegion(@Nullable String region, String publicIp);
|
@Named("ReleaseAddress")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "ReleaseAddress")
|
||||||
|
void releaseAddressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("PublicIp") String publicIp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists elastic IP addresses assigned to your identity or provides information about a specific
|
* Lists elastic IP addresses assigned to your identity or provides information about a specific
|
||||||
|
@ -111,7 +158,14 @@ public interface ElasticIPAddressClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<PublicIpInstanceIdPair> describeAddressesInRegion(@Nullable String region,
|
@Named("DescribeAddresses")
|
||||||
String... publicIps);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeAddresses")
|
||||||
|
@XMLResponseParser(DescribeAddressesResponseHandler.class)
|
||||||
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
|
Set<PublicIpInstanceIdPair> describeAddressesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindPublicIpsToIndexedFormParams.class) String... publicIps);
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,25 +14,60 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindBlockDeviceMappingToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindInstanceIdsToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.IfNotNullBindAvailabilityZoneToFormParam;
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
import org.jclouds.ec2.domain.InstanceStateChange;
|
import org.jclouds.ec2.domain.InstanceStateChange;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
|
import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
|
||||||
|
import org.jclouds.ec2.functions.ConvertUnencodedBytesToBase64EncodedString;
|
||||||
import org.jclouds.ec2.options.RunInstancesOptions;
|
import org.jclouds.ec2.options.RunInstancesOptions;
|
||||||
|
import org.jclouds.ec2.xml.BlockDeviceMappingHandler;
|
||||||
|
import org.jclouds.ec2.xml.BooleanValueHandler;
|
||||||
|
import org.jclouds.ec2.xml.DescribeInstancesResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.GetConsoleOutputResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.InstanceInitiatedShutdownBehaviorHandler;
|
||||||
|
import org.jclouds.ec2.xml.InstanceStateChangeHandler;
|
||||||
|
import org.jclouds.ec2.xml.InstanceTypeHandler;
|
||||||
|
import org.jclouds.ec2.xml.RunInstancesResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.StringValueHandler;
|
||||||
|
import org.jclouds.ec2.xml.UnencodeStringValueHandler;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.ParamParser;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 via their REST API.
|
* Provides access to EC2 Instance Services via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface InstanceClient {
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
|
public interface InstanceApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about instances that you own.
|
* Returns information about instances that you own.
|
||||||
|
@ -56,8 +91,15 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<? extends Reservation<? extends RunningInstance>> describeInstancesInRegion(@Nullable String region,
|
@Named("DescribeInstances")
|
||||||
String... instanceIds);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeInstances")
|
||||||
|
@XMLResponseParser(DescribeInstancesResponseHandler.class)
|
||||||
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
|
Set<? extends Reservation<? extends RunningInstance>> describeInstancesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches a specified number of instances of an AMI for which you have
|
* Launches a specified number of instances of an AMI for which you have
|
||||||
|
@ -136,9 +178,46 @@ public interface InstanceClient {
|
||||||
* />
|
* />
|
||||||
* @see RunInstancesOptions
|
* @see RunInstancesOptions
|
||||||
*/
|
*/
|
||||||
Reservation<? extends RunningInstance> runInstancesInRegion(@Nullable String region,
|
@Named("RunInstances")
|
||||||
@Nullable String nullableAvailabilityZone, String imageId,
|
@POST
|
||||||
int minCount, int maxCount, RunInstancesOptions... options);
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "RunInstances")
|
||||||
|
@XMLResponseParser(RunInstancesResponseHandler.class)
|
||||||
|
Reservation<? extends RunningInstance> runInstancesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@Nullable @BinderParam(IfNotNullBindAvailabilityZoneToFormParam.class) String nullableAvailabilityZone,
|
||||||
|
@FormParam("ImageId") String imageId, @FormParam("MinCount") int minCount,
|
||||||
|
@FormParam("MaxCount") int maxCount, RunInstancesOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests a reboot of one or more instances. This operation is
|
||||||
|
* asynchronous; it only queues a request to reboot the specified
|
||||||
|
* instance(s). The operation will succeed if the instances are valid and
|
||||||
|
* belong to you. Requests to reboot terminated instances are ignored. <h3>
|
||||||
|
* Note</h3> If a Linux/UNIX instance does not cleanly shut down within four
|
||||||
|
* minutes, Amazon EC2 will perform a hard reboot.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Instances are tied to Availability Zones. However, the instance
|
||||||
|
* ID is tied to the Region.
|
||||||
|
*
|
||||||
|
* @param instanceIds
|
||||||
|
* Instance ID to reboot.
|
||||||
|
*
|
||||||
|
* @see #startInstancesInRegion
|
||||||
|
* @see #runInstancesInRegion
|
||||||
|
* @see #describeInstancesInRegion
|
||||||
|
* @see #terminateInstancesInRegion
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html"
|
||||||
|
* />
|
||||||
|
*/
|
||||||
|
@Named("RebootInstances")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "RebootInstances")
|
||||||
|
void rebootInstancesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts down one or more instances. This operation is idempotent; if you
|
* Shuts down one or more instances. This operation is idempotent; if you
|
||||||
|
@ -156,8 +235,15 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-TerminateInstances.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-TerminateInstances.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<? extends InstanceStateChange> terminateInstancesInRegion(@Nullable String region,
|
@Named("TerminateInstances")
|
||||||
String... instanceIds);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "TerminateInstances")
|
||||||
|
@XMLResponseParser(InstanceStateChangeHandler.class)
|
||||||
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
|
Set<? extends InstanceStateChange> terminateInstancesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops an instance that uses an Amazon EBS volume as its root device.
|
* Stops an instance that uses an Amazon EBS volume as its root device.
|
||||||
|
@ -194,32 +280,15 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<? extends InstanceStateChange> stopInstancesInRegion(@Nullable String region,
|
@Named("StopInstances")
|
||||||
boolean force, String... instanceIds);
|
@POST
|
||||||
|
@Path("/")
|
||||||
/**
|
@FormParams(keys = ACTION, values = "StopInstances")
|
||||||
* Requests a reboot of one or more instances. This operation is
|
@XMLResponseParser(InstanceStateChangeHandler.class)
|
||||||
* asynchronous; it only queues a request to reboot the specified
|
Set<? extends InstanceStateChange> stopInstancesInRegion(
|
||||||
* instance(s). The operation will succeed if the instances are valid and
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
* belong to you. Requests to reboot terminated instances are ignored. <h3>
|
@FormParam("Force") boolean force,
|
||||||
* Note</h3> If a Linux/UNIX instance does not cleanly shut down within four
|
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||||
* minutes, Amazon EC2 will perform a hard reboot.
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* Instances are tied to Availability Zones. However, the instance
|
|
||||||
* ID is tied to the Region.
|
|
||||||
*
|
|
||||||
* @param instanceIds
|
|
||||||
* Instance ID to reboot.
|
|
||||||
*
|
|
||||||
* @see #startInstancesInRegion
|
|
||||||
* @see #runInstancesInRegion
|
|
||||||
* @see #describeInstancesInRegion
|
|
||||||
* @see #terminateInstancesInRegion
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
void rebootInstancesInRegion(@Nullable String region, String... instanceIds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts an instance that uses an Amazon EBS volume as its root device.
|
* Starts an instance that uses an Amazon EBS volume as its root device.
|
||||||
|
@ -250,8 +319,14 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StartInstances.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StartInstances.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<? extends InstanceStateChange> startInstancesInRegion(@Nullable String region,
|
@Named("StartInstances")
|
||||||
String... instanceIds);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "StartInstances")
|
||||||
|
@XMLResponseParser(InstanceStateChangeHandler.class)
|
||||||
|
Set<? extends InstanceStateChange> startInstancesInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -262,8 +337,14 @@ public interface InstanceClient {
|
||||||
* which instance to describe the attribute of
|
* which instance to describe the attribute of
|
||||||
* @return unencoded user data
|
* @return unencoded user data
|
||||||
*/
|
*/
|
||||||
String getUserDataForInstanceInRegion(@Nullable String region,
|
@Named("DescribeInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "userData" })
|
||||||
|
@XMLResponseParser(UnencodeStringValueHandler.class)
|
||||||
|
String getUserDataForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -274,8 +355,14 @@ public interface InstanceClient {
|
||||||
* which instance to describe the attribute of
|
* which instance to describe the attribute of
|
||||||
* @return The root device name (e.g., /dev/sda1).
|
* @return The root device name (e.g., /dev/sda1).
|
||||||
*/
|
*/
|
||||||
String getRootDeviceNameForInstanceInRegion(@Nullable String region,
|
@Named("DescribeInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "rootDeviceName" })
|
||||||
|
@XMLResponseParser(StringValueHandler.class)
|
||||||
|
String getRootDeviceNameForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -286,8 +373,14 @@ public interface InstanceClient {
|
||||||
* which instance to describe the attribute of
|
* which instance to describe the attribute of
|
||||||
* @return the ID of the RAM disk associated with the AMI.
|
* @return the ID of the RAM disk associated with the AMI.
|
||||||
*/
|
*/
|
||||||
String getRamdiskForInstanceInRegion(@Nullable String region,
|
@Named("DescribeInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "ramdisk" })
|
||||||
|
@XMLResponseParser(StringValueHandler.class)
|
||||||
|
String getRamdiskForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -298,8 +391,14 @@ public interface InstanceClient {
|
||||||
* which instance to describe the attribute of
|
* which instance to describe the attribute of
|
||||||
* @return the ID of the kernel associated with the AMI.
|
* @return the ID of the kernel associated with the AMI.
|
||||||
*/
|
*/
|
||||||
String getKernelForInstanceInRegion(@Nullable String region,
|
@Named("DescribeInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "kernel" })
|
||||||
|
@XMLResponseParser(StringValueHandler.class)
|
||||||
|
String getKernelForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -312,8 +411,14 @@ public interface InstanceClient {
|
||||||
* You must modify this attribute before you can terminate any
|
* You must modify this attribute before you can terminate any
|
||||||
* "locked" instances from the APIs.
|
* "locked" instances from the APIs.
|
||||||
*/
|
*/
|
||||||
boolean isApiTerminationDisabledForInstanceInRegion(@Nullable String region,
|
@Named("DescribeInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "disableApiTermination" })
|
||||||
|
@XMLResponseParser(BooleanValueHandler.class)
|
||||||
|
boolean isApiTerminationDisabledForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -324,8 +429,14 @@ public interface InstanceClient {
|
||||||
* which instance to describe the attribute of
|
* which instance to describe the attribute of
|
||||||
* @return The instance type of the instance.
|
* @return The instance type of the instance.
|
||||||
*/
|
*/
|
||||||
String getInstanceTypeForInstanceInRegion(@Nullable String region,
|
@Named("DescribeInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "instanceType" })
|
||||||
|
@XMLResponseParser(InstanceTypeHandler.class)
|
||||||
|
String getInstanceTypeForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -337,8 +448,15 @@ public interface InstanceClient {
|
||||||
* @return whether the instance's Amazon EBS volumes are stopped or
|
* @return whether the instance's Amazon EBS volumes are stopped or
|
||||||
* terminated when the instance is shut down.
|
* terminated when the instance is shut down.
|
||||||
*/
|
*/
|
||||||
|
@Named("DescribeInstanceAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
||||||
|
"instanceInitiatedShutdownBehavior" })
|
||||||
|
@XMLResponseParser(InstanceInitiatedShutdownBehaviorHandler.class)
|
||||||
InstanceInitiatedShutdownBehavior getInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
InstanceInitiatedShutdownBehavior getInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
||||||
String region, String instanceId);
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -350,8 +468,14 @@ public interface InstanceClient {
|
||||||
* @return Describes the mapping that defines native device names to use when
|
* @return Describes the mapping that defines native device names to use when
|
||||||
* exposing virtual devices.
|
* exposing virtual devices.
|
||||||
*/
|
*/
|
||||||
|
@Named("DescribeInstanceAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "blockDeviceMapping" })
|
||||||
|
@XMLResponseParser(BlockDeviceMappingHandler.class)
|
||||||
Map<String, BlockDevice> getBlockDeviceMappingForInstanceInRegion(
|
Map<String, BlockDevice> getBlockDeviceMappingForInstanceInRegion(
|
||||||
@Nullable String region, String instanceId);
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets an attribute of an instance to its default value.
|
* Resets an attribute of an instance to its default value.
|
||||||
|
@ -363,8 +487,13 @@ public interface InstanceClient {
|
||||||
* which instance to reset the attribute of
|
* which instance to reset the attribute of
|
||||||
* @return the ID of the RAM disk associated with the AMI.
|
* @return the ID of the RAM disk associated with the AMI.
|
||||||
*/
|
*/
|
||||||
String resetRamdiskForInstanceInRegion(@Nullable String region,
|
@Named("ResetInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "ramdisk" })
|
||||||
|
void resetRamdiskForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets an attribute of an instance to its default value.
|
* Resets an attribute of an instance to its default value.
|
||||||
|
@ -376,8 +505,13 @@ public interface InstanceClient {
|
||||||
* which instance to reset the attribute of
|
* which instance to reset the attribute of
|
||||||
* @return the ID of the kernel associated with the AMI.
|
* @return the ID of the kernel associated with the AMI.
|
||||||
*/
|
*/
|
||||||
String resetKernelForInstanceInRegion(@Nullable String region,
|
@Named("ResetInstanceAttribute")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "kernel" })
|
||||||
|
void resetKernelForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the userData used for starting the instance.
|
* Sets the userData used for starting the instance.
|
||||||
|
@ -400,8 +534,14 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void setUserDataForInstanceInRegion(@Nullable String region,
|
@Named("ModifyInstanceAttribute")
|
||||||
String instanceId, byte[] unencodedData);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "userData" })
|
||||||
|
void setUserDataForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId,
|
||||||
|
@FormParam("Value") @ParamParser(ConvertUnencodedBytesToBase64EncodedString.class) byte[] unencodedData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ramdisk used for starting the instance.
|
* Sets the ramdisk used for starting the instance.
|
||||||
|
@ -424,8 +564,13 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void setRamdiskForInstanceInRegion(@Nullable String region,
|
@Named("ModifyInstanceAttribute")
|
||||||
String instanceId, String ramdisk);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "ramdisk" })
|
||||||
|
void setRamdiskForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId, @FormParam("Value") String ramdisk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the kernelId used for starting the instance.
|
* Sets the kernelId used for starting the instance.
|
||||||
|
@ -448,8 +593,13 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void setKernelForInstanceInRegion(@Nullable String region,
|
@Named("ModifyInstanceAttribute")
|
||||||
String instanceId, String kernel);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "kernel" })
|
||||||
|
void setKernelForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId, @FormParam("Value") String kernel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This command works while the instance is running and controls whether or
|
* This command works while the instance is running and controls whether or
|
||||||
|
@ -465,8 +615,13 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void setApiTerminationDisabledForInstanceInRegion(@Nullable String region,
|
@Named("ModifyInstanceAttribute")
|
||||||
String instanceId, boolean apiTerminationDisabled);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "disableApiTermination" })
|
||||||
|
void setApiTerminationDisabledForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId, @FormParam("Value") boolean apiTerminationDisabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the instanceType used for starting the instance.
|
* Sets the instanceType used for starting the instance.
|
||||||
|
@ -489,8 +644,13 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void setInstanceTypeForInstanceInRegion(@Nullable String region,
|
@Named("ModifyInstanceAttribute")
|
||||||
String instanceId, String instanceType);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceType" })
|
||||||
|
void setInstanceTypeForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId, @FormParam("Value") String instanceType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether the instance's Amazon EBS volumes are stopped or
|
* Specifies whether the instance's Amazon EBS volumes are stopped or
|
||||||
|
@ -515,9 +675,15 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
|
@Named("ModifyInstanceAttribute")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
|
||||||
|
"instanceInitiatedShutdownBehavior" })
|
||||||
void setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
void setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
||||||
@Nullable String region, String instanceId,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior);
|
@FormParam("InstanceId") String instanceId,
|
||||||
|
@FormParam("Value") InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the blockDeviceMapping used for an instance.
|
* Sets the blockDeviceMapping used for an instance.
|
||||||
|
@ -564,8 +730,14 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void setBlockDeviceMappingForInstanceInRegion(@Nullable String region,
|
@Named("ModifyInstanceAttribute")
|
||||||
String instanceId, Map<String, BlockDevice> blockDeviceMapping);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION }, values = { "ModifyInstanceAttribute" })
|
||||||
|
void setBlockDeviceMappingForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId,
|
||||||
|
@BinderParam(BindBlockDeviceMappingToIndexedFormParams.class) Map<String, BlockDevice> blockDeviceMapping);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves console output for the specified instance.
|
* Retrieves console output for the specified instance.
|
||||||
|
@ -582,6 +754,12 @@ public interface InstanceClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetConsoleOutput.html">
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetConsoleOutput.html">
|
||||||
* ApiReference query GetConsoleOutput</a>
|
* ApiReference query GetConsoleOutput</a>
|
||||||
*/
|
*/
|
||||||
String getConsoleOutputForInstanceInRegion(@Nullable String region,
|
@Named("GetConsoleOutput")
|
||||||
String instanceId);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = { ACTION }, values = { "GetConsoleOutput" })
|
||||||
|
@XMLResponseParser(GetConsoleOutputResponseHandler.class)
|
||||||
|
String getConsoleOutputForInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 via their REST API.
|
* Provides access to EC2 via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -51,22 +49,50 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@RequestFilters(FormSigner.class)
|
@RequestFilters(FormSigner.class)
|
||||||
@VirtualHost
|
@VirtualHost
|
||||||
public interface KeyPairAsyncClient {
|
public interface KeyPairApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeyPairClient#createKeyPairInRegion
|
* Creates a new 2048-bit RSA key pair with the specified name. The public key is stored by
|
||||||
|
* Amazon EC2 and the private key is displayed on the console. The private key is returned as an
|
||||||
|
* unencrypted PEM encoded PKCS#8 private key. If a key with the specified name already exists,
|
||||||
|
* Amazon EC2 returns an error.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Key pairs (to connect to instances) are Region-specific.
|
||||||
|
* @param keyName
|
||||||
|
* A unique name for the key pair.
|
||||||
|
*
|
||||||
|
* @see #runInstances
|
||||||
|
* @see #describeKeyPairs
|
||||||
|
* @see #deleteKeyPair
|
||||||
|
*
|
||||||
|
* @see <a href=
|
||||||
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateKeyPair.html"
|
||||||
|
* />
|
||||||
*/
|
*/
|
||||||
@Named("CreateKeyPair")
|
@Named("CreateKeyPair")
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@FormParams(keys = ACTION, values = "CreateKeyPair")
|
@FormParams(keys = ACTION, values = "CreateKeyPair")
|
||||||
@XMLResponseParser(KeyPairResponseHandler.class)
|
@XMLResponseParser(KeyPairResponseHandler.class)
|
||||||
ListenableFuture<KeyPair> createKeyPairInRegion(
|
KeyPair createKeyPairInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
@FormParam("KeyName") String keyName);
|
@FormParam("KeyName") String keyName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeyPairClient#describeKeyPairsInRegion
|
* Returns information about key pairs available to you. If you specify key pairs, information
|
||||||
|
* about those key pairs is returned. Otherwise, information for all registered key pairs is
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Key pairs (to connect to instances) are Region-specific.
|
||||||
|
* @param keyPairNames
|
||||||
|
* Key pairs to describe.
|
||||||
|
*
|
||||||
|
* @see #runInstances
|
||||||
|
* @see #describeAvailabilityZones
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html"
|
||||||
|
* />
|
||||||
*/
|
*/
|
||||||
@Named("DescribeKeyPairs")
|
@Named("DescribeKeyPairs")
|
||||||
@POST
|
@POST
|
||||||
|
@ -74,18 +100,31 @@ public interface KeyPairAsyncClient {
|
||||||
@FormParams(keys = ACTION, values = "DescribeKeyPairs")
|
@FormParams(keys = ACTION, values = "DescribeKeyPairs")
|
||||||
@XMLResponseParser(DescribeKeyPairsResponseHandler.class)
|
@XMLResponseParser(DescribeKeyPairsResponseHandler.class)
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion(
|
Set<KeyPair> describeKeyPairsInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
@BinderParam(BindKeyNamesToIndexedFormParams.class) String... keyPairNames);
|
@BinderParam(BindKeyNamesToIndexedFormParams.class) String... keyPairNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeyPairClient#deleteKeyPairInRegion
|
* Deletes the specified key pair, by removing the public key from Amazon EC2. You must own the
|
||||||
|
* key pair
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Key pairs (to connect to instances) are Region-specific.
|
||||||
|
* @param keyName
|
||||||
|
* Name of the key pair to delete
|
||||||
|
*
|
||||||
|
* @see #describeKeyPairs
|
||||||
|
* @see #createKeyPair
|
||||||
|
*
|
||||||
|
* @see <a href=
|
||||||
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteKeyPair.html"
|
||||||
|
* />
|
||||||
*/
|
*/
|
||||||
@Named("DeleteKeyPair")
|
@Named("DeleteKeyPair")
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@FormParams(keys = ACTION, values = "DeleteKeyPair")
|
@FormParams(keys = ACTION, values = "DeleteKeyPair")
|
||||||
ListenableFuture<Void> deleteKeyPairInRegion(
|
void deleteKeyPairInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
@FormParam("KeyName") String keyName);
|
@FormParam("KeyName") String keyName);
|
||||||
|
|
|
@ -14,13 +14,35 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindGroupNamesToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams;
|
||||||
import org.jclouds.ec2.domain.SecurityGroup;
|
import org.jclouds.ec2.domain.SecurityGroup;
|
||||||
import org.jclouds.ec2.domain.UserIdGroupPair;
|
import org.jclouds.ec2.domain.UserIdGroupPair;
|
||||||
|
import org.jclouds.ec2.xml.DescribeSecurityGroupsResponseHandler;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
import org.jclouds.net.domain.IpProtocol;
|
import org.jclouds.net.domain.IpProtocol;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 via their REST API.
|
* Provides access to EC2 via their REST API.
|
||||||
|
@ -28,7 +50,9 @@ import org.jclouds.net.domain.IpProtocol;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface SecurityGroupClient {
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
|
public interface SecurityGroupApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new security group. Group names must be unique per identity.
|
* Creates a new security group. Group names must be unique per identity.
|
||||||
|
@ -53,7 +77,13 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSecurityGroup.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSecurityGroup.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void createSecurityGroupInRegion(@Nullable String region, String name, String description);
|
@Named("CreateSecurityGroup")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateSecurityGroup")
|
||||||
|
void createSecurityGroupInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("GroupName") String name, @FormParam("GroupDescription") String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a security group that you own.
|
* Deletes a security group that you own.
|
||||||
|
@ -73,7 +103,13 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
void deleteSecurityGroupInRegion(@Nullable String region, String name);
|
@Named("DeleteSecurityGroup")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DeleteSecurityGroup")
|
||||||
|
@Fallback(VoidOnNotFoundOr404.class)
|
||||||
|
void deleteSecurityGroupInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @FormParam("GroupName") String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about security groups that you own.
|
* Returns information about security groups that you own.
|
||||||
|
@ -93,8 +129,15 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
Set<SecurityGroup> describeSecurityGroupsInRegion(@Nullable String region,
|
@Named("DescribeSecurityGroups")
|
||||||
String... securityGroupNames);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeSecurityGroups")
|
||||||
|
@XMLResponseParser(DescribeSecurityGroupsResponseHandler.class)
|
||||||
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
|
Set<SecurityGroup> describeSecurityGroupsInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindGroupNamesToIndexedFormParams.class) String... securityGroupNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -117,8 +160,14 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void authorizeSecurityGroupIngressInRegion(@Nullable String region, String groupName,
|
@Named("AuthorizeSecurityGroupIngress")
|
||||||
UserIdGroupPair sourceSecurityGroup);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
|
||||||
|
void authorizeSecurityGroupIngressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("GroupName") String groupName,
|
||||||
|
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -156,8 +205,14 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void authorizeSecurityGroupIngressInRegion(@Nullable String region, String groupName,
|
@Named("AuthorizeSecurityGroupIngress")
|
||||||
IpProtocol ipProtocol, int fromPort, int toPort, String cidrIp);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
|
||||||
|
void authorizeSecurityGroupIngressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol,
|
||||||
|
@FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -181,8 +236,14 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void revokeSecurityGroupIngressInRegion(@Nullable String region, String groupName,
|
@Named("RevokeSecurityGroupIngress")
|
||||||
UserIdGroupPair sourceSecurityGroup);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
|
||||||
|
void revokeSecurityGroupIngressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("GroupName") String groupName,
|
||||||
|
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -221,6 +282,12 @@ public interface SecurityGroupClient {
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void revokeSecurityGroupIngressInRegion(@Nullable String region, String groupName, IpProtocol ipProtocol,
|
@Named("RevokeSecurityGroupIngress")
|
||||||
int fromPort, int toPort, String cidrIp);
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
|
||||||
|
void revokeSecurityGroupIngressInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol,
|
||||||
|
@FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp);
|
||||||
}
|
}
|
|
@ -16,25 +16,40 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.features;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams;
|
||||||
import org.jclouds.ec2.domain.Subnet;
|
import org.jclouds.ec2.domain.Subnet;
|
||||||
import org.jclouds.ec2.util.SubnetFilterBuilder;
|
import org.jclouds.ec2.xml.DescribeSubnetsResponseHandler;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.SinceApiVersion;
|
import org.jclouds.rest.annotations.SinceApiVersion;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To help you manage your Amazon EC2 instances, images, and other Amazon EC2 resources, you can assign your own
|
* Provides access to Amazon EC2 via the Query API
|
||||||
* metadata to each resource in the form of tags.
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html" >doc</a>
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
|
||||||
* @see SubnetAsyncApi
|
* >doc</a>
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @author Andrew Bayer
|
* @author Andrew Bayer
|
||||||
*/
|
*/
|
||||||
@SinceApiVersion("2011-01-01")
|
@SinceApiVersion("2011-01-01")
|
||||||
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
public interface SubnetApi {
|
public interface SubnetApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes all of your subnets for your EC2 resources.
|
* Describes all of your subnets for your EC2 resources.
|
||||||
*
|
*
|
||||||
|
@ -43,6 +58,12 @@ public interface SubnetApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
|
||||||
* >docs</href>
|
* >docs</href>
|
||||||
*/
|
*/
|
||||||
|
@Named("DescribeSubnets")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeSubnets")
|
||||||
|
@XMLResponseParser(DescribeSubnetsResponseHandler.class)
|
||||||
|
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||||
FluentIterable<Subnet> list();
|
FluentIterable<Subnet> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,6 +82,13 @@ public interface SubnetApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
|
||||||
* >docs</href>
|
* >docs</href>
|
||||||
*/
|
*/
|
||||||
FluentIterable<Subnet> filter(Multimap<String, String> filter);
|
@Named("DescribeSubnets")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeSubnets")
|
||||||
|
@XMLResponseParser(DescribeSubnetsResponseHandler.class)
|
||||||
|
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||||
|
FluentIterable<Subnet> filter(
|
||||||
|
@BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.features;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.domain.Subnet;
|
|
||||||
import org.jclouds.ec2.xml.DescribeSubnetsResponseHandler;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.SinceApiVersion;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to Amazon EC2 via the Query API
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
|
|
||||||
* >doc</a>
|
|
||||||
* @see SubnetApi
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Andrew Bayer
|
|
||||||
*/
|
|
||||||
@SinceApiVersion("2011-01-01")
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface SubnetAsyncApi {
|
|
||||||
/**
|
|
||||||
* @see SubnetApi#list()
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("DescribeSubnets")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeSubnets")
|
|
||||||
@XMLResponseParser(DescribeSubnetsResponseHandler.class)
|
|
||||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<FluentIterable<Subnet>> list();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SubnetApi#filter
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("DescribeSubnets")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeSubnets")
|
|
||||||
@XMLResponseParser(DescribeSubnetsResponseHandler.class)
|
|
||||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<FluentIterable<Subnet>> filter(
|
|
||||||
@BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter);
|
|
||||||
|
|
||||||
}
|
|
|
@ -16,28 +16,45 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.features;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindResourceIdsToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindTagKeysToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindTagsToIndexedFormParams;
|
||||||
import org.jclouds.ec2.domain.Tag;
|
import org.jclouds.ec2.domain.Tag;
|
||||||
import org.jclouds.ec2.util.TagFilterBuilder;
|
import org.jclouds.ec2.xml.DescribeTagsResponseHandler;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.SinceApiVersion;
|
import org.jclouds.rest.annotations.SinceApiVersion;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To help you manage your Amazon EC2 instances, images, and other Amazon EC2
|
* Provides access to Amazon EC2 via the Query API
|
||||||
* resources, you can assign your own metadata to each resource in the form of
|
* <p/>
|
||||||
* tags.
|
|
||||||
*
|
*
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/Using_Tags.html"
|
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html"
|
||||||
* >doc</a>
|
* >doc</a>
|
||||||
* @see TagAsyncApi
|
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@SinceApiVersion("2010-08-31")
|
@SinceApiVersion("2010-08-31")
|
||||||
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
public interface TagApi {
|
public interface TagApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds or overwrites one or more tags for the specified resource or
|
* Adds or overwrites one or more tags for the specified resource or
|
||||||
* resources. Each resource can have a maximum of 10 tags. Each tag consists
|
* resources. Each resource can have a maximum of 10 tags. Each tag consists
|
||||||
|
@ -58,7 +75,12 @@ public interface TagApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html"
|
||||||
* >docs</href>
|
* >docs</href>
|
||||||
*/
|
*/
|
||||||
void applyToResources(Map<String, String> tags, Iterable<String> resourceIds);
|
@Named("CreateTags")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateTags")
|
||||||
|
void applyToResources(@BinderParam(BindTagsToIndexedFormParams.class) Iterable<String> tags,
|
||||||
|
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* like {@link #applyToResources(Map, Iterable)} except that the tags have no
|
* like {@link #applyToResources(Map, Iterable)} except that the tags have no
|
||||||
|
@ -72,7 +94,12 @@ public interface TagApi {
|
||||||
*
|
*
|
||||||
* @see #applyToResources(Map, Iterable)
|
* @see #applyToResources(Map, Iterable)
|
||||||
*/
|
*/
|
||||||
void applyToResources(Iterable<String> tags, Iterable<String> resourceIds);
|
@Named("CreateTags")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CreateTags")
|
||||||
|
void applyToResources(@BinderParam(BindTagsToIndexedFormParams.class) Map<String, String> tags,
|
||||||
|
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes all of your tags for your EC2 resources.
|
* Describes all of your tags for your EC2 resources.
|
||||||
|
@ -82,6 +109,12 @@ public interface TagApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html"
|
||||||
* >docs</href>
|
* >docs</href>
|
||||||
*/
|
*/
|
||||||
|
@Named("DescribeTags")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeTags")
|
||||||
|
@XMLResponseParser(DescribeTagsResponseHandler.class)
|
||||||
|
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||||
FluentIterable<Tag> list();
|
FluentIterable<Tag> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +133,14 @@ public interface TagApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html"
|
||||||
* >docs</href>
|
* >docs</href>
|
||||||
*/
|
*/
|
||||||
FluentIterable<Tag> filter(Multimap<String, String> filter);
|
@Named("DescribeTags")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeTags")
|
||||||
|
@XMLResponseParser(DescribeTagsResponseHandler.class)
|
||||||
|
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||||
|
FluentIterable<Tag> filter(
|
||||||
|
@BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a specific set of tags from a specific set of resources. This call
|
* Deletes a specific set of tags from a specific set of resources. This call
|
||||||
|
@ -124,7 +164,13 @@ public interface TagApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html"
|
||||||
* >docs</href>
|
* >docs</href>
|
||||||
*/
|
*/
|
||||||
void deleteFromResources(Iterable<String> tags, Iterable<String> resourceIds);
|
@Named("DeleteTags")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DeleteTags")
|
||||||
|
void deleteFromResources(
|
||||||
|
@BinderParam(BindTagKeysToIndexedFormParams.class) Iterable<String> tags,
|
||||||
|
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* like {@link #deleteFromResources(Iterable, Iterable)}, except that the
|
* like {@link #deleteFromResources(Iterable, Iterable)}, except that the
|
||||||
|
@ -144,6 +190,12 @@ public interface TagApi {
|
||||||
* {@code ami-1a2b3c4d}
|
* {@code ami-1a2b3c4d}
|
||||||
* @see #deleteFromResources(Iterable, Iterable)
|
* @see #deleteFromResources(Iterable, Iterable)
|
||||||
*/
|
*/
|
||||||
void conditionallyDeleteFromResources(Map<String, String> conditionalTagValues, Iterable<String> resourceIds);
|
@Named("DeleteTags")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DeleteTags")
|
||||||
|
void conditionallyDeleteFromResources(
|
||||||
|
@BinderParam(BindTagsToIndexedFormParams.class) Map<String, String> conditionalTagValues,
|
||||||
|
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.features;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindResourceIdsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindTagKeysToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindTagsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.domain.Tag;
|
|
||||||
import org.jclouds.ec2.xml.DescribeTagsResponseHandler;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.SinceApiVersion;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to Amazon EC2 via the Query API
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html"
|
|
||||||
* >doc</a>
|
|
||||||
* @see TagApi
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@SinceApiVersion("2010-08-31")
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface TagAsyncApi {
|
|
||||||
/**
|
|
||||||
* @see TagApi#applyToResources(Iterable, Iterable)
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("CreateTags")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateTags")
|
|
||||||
ListenableFuture<Void> applyToResources(@BinderParam(BindTagsToIndexedFormParams.class) Iterable<String> tags,
|
|
||||||
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TagApi#applyToResources(Map, Iterable)
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("CreateTags")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateTags")
|
|
||||||
ListenableFuture<Void> applyToResources(@BinderParam(BindTagsToIndexedFormParams.class) Map<String, String> tags,
|
|
||||||
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TagApi#list()
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("DescribeTags")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeTags")
|
|
||||||
@XMLResponseParser(DescribeTagsResponseHandler.class)
|
|
||||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<FluentIterable<Tag>> list();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TagApi#filter
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("DescribeTags")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeTags")
|
|
||||||
@XMLResponseParser(DescribeTagsResponseHandler.class)
|
|
||||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<FluentIterable<Tag>> filter(
|
|
||||||
@BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TagApi#deleteFromResources
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("DeleteTags")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DeleteTags")
|
|
||||||
ListenableFuture<Void> deleteFromResources(
|
|
||||||
@BinderParam(BindTagKeysToIndexedFormParams.class) Iterable<String> tags,
|
|
||||||
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TagApi#conditionallyDeleteFromResources
|
|
||||||
* @see <a
|
|
||||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html">docs</a>
|
|
||||||
*/
|
|
||||||
@Named("DeleteTags")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DeleteTags")
|
|
||||||
ListenableFuture<Void> conditionallyDeleteFromResources(
|
|
||||||
@BinderParam(BindTagsToIndexedFormParams.class) Map<String, String> conditionalTagValues,
|
|
||||||
@BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds);
|
|
||||||
|
|
||||||
}
|
|
|
@ -16,23 +16,165 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.features;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.PasswordData;
|
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||||
import org.jclouds.rest.annotations.SinceApiVersion;
|
|
||||||
|
|
||||||
import com.google.common.annotations.Beta;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
|
import org.jclouds.ec2.binders.BindBundleIdsToIndexedFormParams;
|
||||||
|
import org.jclouds.ec2.binders.BindS3UploadPolicyAndSignature;
|
||||||
|
import org.jclouds.ec2.domain.BundleTask;
|
||||||
|
import org.jclouds.ec2.domain.PasswordData;
|
||||||
|
import org.jclouds.ec2.options.BundleInstanceS3StorageOptions;
|
||||||
|
import org.jclouds.ec2.xml.BundleTaskHandler;
|
||||||
|
import org.jclouds.ec2.xml.DescribeBundleTasksResponseHandler;
|
||||||
|
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.SinceApiVersion;
|
||||||
|
import org.jclouds.rest.annotations.VirtualHost;
|
||||||
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to EC2 Windows Features via the Query API
|
* Provides access to EC2 Windows Features via the Query API
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference" >doc</a>
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference" >doc</a>
|
||||||
* @see WindowsAsyncApi
|
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Beta
|
@RequestFilters(FormSigner.class)
|
||||||
|
@VirtualHost
|
||||||
@SinceApiVersion("2008-08-08")
|
@SinceApiVersion("2008-08-08")
|
||||||
public interface WindowsApi {
|
public interface WindowsApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bundles the Windows instance. This procedure is not applicable for Linux
|
||||||
|
* and UNIX instances. For more information, go to the Amazon Elastic Compute
|
||||||
|
* Cloud Developer Guide or Amazon Elastic Compute Cloud Getting Started
|
||||||
|
* Guide.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Bundles are tied to the Region where its files are located
|
||||||
|
* within Amazon S3.
|
||||||
|
*
|
||||||
|
* @param instanceId
|
||||||
|
* The ID of the instance to bundle.
|
||||||
|
* @param prefix
|
||||||
|
* Specifies the beginning of the file name of the AMI.
|
||||||
|
* @param bucket
|
||||||
|
* The bucket in which to store the AMI. You can specify a bucket
|
||||||
|
* that you already own or a new bucket that Amazon EC2 creates on
|
||||||
|
* your behalf. If you specify a bucket that belongs to someone
|
||||||
|
* else, Amazon EC2 returns an error.
|
||||||
|
* @param uploadPolicy
|
||||||
|
* An Amazon S3 upload policy that gives Amazon EC2 permission to
|
||||||
|
* upload items into Amazon S3 on the user's behalf.
|
||||||
|
* <p/>
|
||||||
|
* ex.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* {"expiration": "2008-08-30T08:49:09Z","conditions": ["bucket": "my-bucket"},["starts-with", "$key", "my-new-image"]]}
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param options
|
||||||
|
* if the bucket isn't owned by you, use this to set the bucket's
|
||||||
|
* accesskeyid
|
||||||
|
* @return status of the work
|
||||||
|
*
|
||||||
|
* @see #cancelBundleTaskInRegion
|
||||||
|
* @see #describeBundleTasksInRegion
|
||||||
|
*
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-BundleInstance.html"
|
||||||
|
* />
|
||||||
|
*/
|
||||||
|
@Named("BundleInstance")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "BundleInstance")
|
||||||
|
@XMLResponseParser(BundleTaskHandler.class)
|
||||||
|
BundleTask bundleInstanceInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId, @FormParam("Storage.S3.Prefix") String prefix,
|
||||||
|
@FormParam("Storage.S3.Bucket") String bucket,
|
||||||
|
@BinderParam(BindS3UploadPolicyAndSignature.class) String uploadPolicy,
|
||||||
|
BundleInstanceS3StorageOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels an Amazon EC2 bundling operation.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* The bundleTask ID is tied to the Region.
|
||||||
|
* @param bundleId
|
||||||
|
* The ID of the bundle task to cancel.
|
||||||
|
* @return task for the cancel.
|
||||||
|
*
|
||||||
|
* @see #bundleInstanceInRegion
|
||||||
|
* @see #describeBundleTasksInRegion
|
||||||
|
*
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CancelBundleTask.html"
|
||||||
|
* />
|
||||||
|
*/
|
||||||
|
@Named("CancelBundleTask")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "CancelBundleTask")
|
||||||
|
@XMLResponseParser(BundleTaskHandler.class)
|
||||||
|
BundleTask cancelBundleTaskInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("BundleId") String bundleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Describes current bundling tasks.
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* The bundleTask ID is tied to the Region.
|
||||||
|
*
|
||||||
|
* @see #cancelBundleTaskInRegion
|
||||||
|
* @see #bundleInstanceInRegion
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeBundleTasks.html"
|
||||||
|
* />
|
||||||
|
*/
|
||||||
|
@Named("DescribeBundleTasks")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "DescribeBundleTasks")
|
||||||
|
@XMLResponseParser(DescribeBundleTasksResponseHandler.class)
|
||||||
|
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||||
|
Set<BundleTask> describeBundleTasksInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@BinderParam(BindBundleIdsToIndexedFormParams.class) String... bundleTaskIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Retrieves the encrypted administrator password for the instances running Windows.
|
||||||
|
*
|
||||||
|
* @param region The region where the instance is based
|
||||||
|
* @param instanceId The ID of the instance to query
|
||||||
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html" />
|
||||||
|
*/
|
||||||
|
@Named("GetPasswordData")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "GetPasswordData")
|
||||||
|
@XMLResponseParser(GetPasswordDataResponseHandler.class)
|
||||||
|
PasswordData getPasswordDataInRegion(
|
||||||
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
|
@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Retrieves the encrypted administrator password for the instances running Windows. <h4>Note</h4>
|
* Retrieves the encrypted administrator password for the instances running Windows. <h4>Note</h4>
|
||||||
|
@ -49,5 +191,12 @@ public interface WindowsApi {
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
PasswordData getPasswordDataForInstance(String instanceId);
|
@Named("GetPasswordData")
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@FormParams(keys = ACTION, values = "GetPasswordData")
|
||||||
|
@XMLResponseParser(GetPasswordDataResponseHandler.class)
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
PasswordData getPasswordDataForInstance(@FormParam("InstanceId") String instanceId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.features;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.domain.PasswordData;
|
|
||||||
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.SinceApiVersion;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.annotations.Beta;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 Windows Features via the Query API
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference" >doc</a>
|
|
||||||
* @see WindowsAsyncApi
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
@Beta
|
|
||||||
@SinceApiVersion("2008-08-08")
|
|
||||||
public interface WindowsAsyncApi {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see WindowsApi#getPasswordDataForInstance
|
|
||||||
*/
|
|
||||||
@Named("GetPasswordData")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "GetPasswordData")
|
|
||||||
@XMLResponseParser(GetPasswordDataResponseHandler.class)
|
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<PasswordData> getPasswordDataForInstance(@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -39,7 +39,7 @@ import com.google.inject.Inject;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.*
|
* import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* String imageId = connection.getWindowsServices().bundleInstanceInRegion(...bucketOwnedBy(anotherAccessKey));
|
* String imageId = connection.getWindowsServices().bundleInstanceInRegion(...bucketOwnedBy(anotherAccessKey));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.CreateImageOptions.Builder.*
|
* import static org.jclouds.ec2.options.CreateImageOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Future<Set<ImageMetadata>> images = connection.getAMIServices().createImage(withDescription("123125").noReboot());
|
* Future<Set<ImageMetadata>> images = connection.getAMIApi().get().createImage(withDescription("123125").noReboot());
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.*
|
* import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Snapshot snapshot = connection.getElasticBlockStoreServices().createSnapshotInRegion(volumeId, withDescription("123125"));
|
* Snapshot snapshot = connection.getElasticBlockStoreApi().get().createSnapshotInRegion(volumeId, withDescription("123125"));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
|
|
@ -30,8 +30,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.*
|
* import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Future<Set<ImageMetadata>> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
|
* Future<Set<ImageMetadata>> images = connection.getAvailabilityZoneAndRegionApi().get().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.*
|
* import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Future<Set<ImageMetadata>> images = connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000, 1004));
|
* Future<Set<ImageMetadata>> images = connection.getAMIApi().get().describeImages(executableBy("123125").imageIds(1000, 1004));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.*
|
* import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Future<Set<ImageMetadata>> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
|
* Future<Set<ImageMetadata>> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.*
|
* import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Set<Snapshot> snapshots = connection.getElasticBlockStoreServices().describeSnapshots(restorableBy("123125").snapshotIds(1000, 1004));
|
* Set<Snapshot> snapshots = connection.getElasticBlockStoreApi().get().describeSnapshots(restorableBy("123125").snapshotIds(1000, 1004));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.*
|
* import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client client = // get connection
|
* EC2Api client = // get connection
|
||||||
* client.getElasticBlockStoreServices().detachVolumeInRegion(null, id, fromDevice("123125").force());
|
* client.getElasticBlockStoreApi().get().detachVolumeInRegion(null, id, fromDevice("123125").force());
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.javax.annotation.Nullable;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.*
|
* import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* String imageId = connection.getImageServices().registerImageBackedByEbs(...addEphemeralBlockDeviceFromSnapshot("/dev/sda2","virtual-1","snapshot-id"));
|
* String imageId = connection.getImageServices().registerImageBackedByEbs(...addEphemeralBlockDeviceFromSnapshot("/dev/sda2","virtual-1","snapshot-id"));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.ec2.options.RegisterImageOptions.Builder.*
|
* import static org.jclouds.ec2.options.RegisterImageOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* String imageId = connection.getImageServices().registerImageFromManifest(...withArchitecture(Architecture.I386).withDescription("description"));
|
* String imageId = connection.getImageServices().registerImageFromManifest(...withArchitecture(Architecture.I386).withDescription("description"));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.aws.ec2.options.RunInstancesOptions.Builder.*
|
* import static org.jclouds.aws.ec2.options.RunInstancesOptions.Builder.*
|
||||||
* <p/>
|
* <p/>
|
||||||
* EC2Client connection = // get connection
|
* EC2Api connection = // get connection
|
||||||
* Future<ReservationInfo> instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
|
* Future<ReservationInfo> instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,7 +20,7 @@ import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.AWSResponseException;
|
import org.jclouds.aws.AWSResponseException;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InstanceHasIpAddress implements Predicate<RunningInstance> {
|
public class InstanceHasIpAddress implements Predicate<RunningInstance> {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InstanceHasIpAddress(EC2Client client) {
|
public InstanceHasIpAddress(EC2Api client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class InstanceHasIpAddress implements Predicate<RunningInstance> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private RunningInstance refresh(RunningInstance instance) {
|
private RunningInstance refresh(RunningInstance instance) {
|
||||||
return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceServices()
|
return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(instance.getRegion(), instance.getId())));
|
.describeInstancesInRegion(instance.getRegion(), instance.getId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jclouds.ec2.predicates;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -38,13 +38,13 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InstanceStateRunning implements Predicate<RunningInstance> {
|
public class InstanceStateRunning implements Predicate<RunningInstance> {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InstanceStateRunning(EC2Client client) {
|
public InstanceStateRunning(EC2Api client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class InstanceStateRunning implements Predicate<RunningInstance> {
|
||||||
|
|
||||||
private RunningInstance refresh(RunningInstance instance) {
|
private RunningInstance refresh(RunningInstance instance) {
|
||||||
return Iterables.getOnlyElement(Iterables.getOnlyElement(client
|
return Iterables.getOnlyElement(Iterables.getOnlyElement(client
|
||||||
.getInstanceServices().describeInstancesInRegion(
|
.getInstanceApi().get().describeInstancesInRegion(
|
||||||
instance.getRegion(), instance.getId())));
|
instance.getRegion(), instance.getId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -37,13 +37,13 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InstanceStateStopped implements Predicate<RunningInstance> {
|
public class InstanceStateStopped implements Predicate<RunningInstance> {
|
||||||
|
|
||||||
private final InstanceClient client;
|
private final InstanceApi client;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InstanceStateStopped(InstanceClient client) {
|
public InstanceStateStopped(InstanceApi client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.NoSuchElementException;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
@ -39,13 +39,13 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InstanceStateTerminated implements Predicate<RunningInstance> {
|
public class InstanceStateTerminated implements Predicate<RunningInstance> {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Api client;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InstanceStateTerminated(EC2Client client) {
|
public InstanceStateTerminated(EC2Api client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class InstanceStateTerminated implements Predicate<RunningInstance> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private RunningInstance refresh(RunningInstance instance) {
|
private RunningInstance refresh(RunningInstance instance) {
|
||||||
return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceServices()
|
return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(instance.getRegion(), instance.getId())));
|
.describeInstancesInRegion(instance.getRegion(), instance.getId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.Snapshot;
|
import org.jclouds.ec2.domain.Snapshot;
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -38,12 +38,12 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SnapshotCompleted implements Predicate<Snapshot> {
|
public class SnapshotCompleted implements Predicate<Snapshot> {
|
||||||
|
|
||||||
private final ElasticBlockStoreClient client;
|
private final ElasticBlockStoreApi client;
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SnapshotCompleted(ElasticBlockStoreClient client) {
|
public SnapshotCompleted(ElasticBlockStoreApi client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
import org.jclouds.ec2.domain.Attachment;
|
||||||
import org.jclouds.ec2.domain.Volume;
|
import org.jclouds.ec2.domain.Volume;
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -38,12 +38,12 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VolumeAttached implements Predicate<Attachment> {
|
public class VolumeAttached implements Predicate<Attachment> {
|
||||||
|
|
||||||
private final ElasticBlockStoreClient client;
|
private final ElasticBlockStoreApi client;
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VolumeAttached(ElasticBlockStoreClient client) {
|
public VolumeAttached(ElasticBlockStoreApi client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.Volume;
|
import org.jclouds.ec2.domain.Volume;
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -36,12 +36,12 @@ import com.google.inject.Inject;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VolumeAvailable implements Predicate<Volume> {
|
public class VolumeAvailable implements Predicate<Volume> {
|
||||||
|
|
||||||
private final ElasticBlockStoreClient client;
|
private final ElasticBlockStoreApi client;
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VolumeAvailable(ElasticBlockStoreClient client) {
|
public VolumeAvailable(ElasticBlockStoreApi client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
import org.jclouds.ec2.domain.Attachment;
|
||||||
import org.jclouds.ec2.domain.Volume;
|
import org.jclouds.ec2.domain.Volume;
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -38,12 +38,12 @@ import com.google.inject.Singleton;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VolumeDetached implements Predicate<Attachment> {
|
public class VolumeDetached implements Predicate<Attachment> {
|
||||||
|
|
||||||
private final ElasticBlockStoreClient client;
|
private final ElasticBlockStoreApi client;
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VolumeDetached(ElasticBlockStoreClient client) {
|
public VolumeDetached(ElasticBlockStoreApi client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,192 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.domain.Image;
|
|
||||||
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
|
||||||
import org.jclouds.ec2.domain.Permission;
|
|
||||||
import org.jclouds.ec2.options.CreateImageOptions;
|
|
||||||
import org.jclouds.ec2.options.DescribeImagesOptions;
|
|
||||||
import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions;
|
|
||||||
import org.jclouds.ec2.options.RegisterImageOptions;
|
|
||||||
import org.jclouds.ec2.xml.BlockDeviceMappingHandler;
|
|
||||||
import org.jclouds.ec2.xml.DescribeImagesResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.ImageIdHandler;
|
|
||||||
import org.jclouds.ec2.xml.PermissionHandler;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to AMI Services.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface AMIAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#describeImagesInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeImages")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeImages")
|
|
||||||
@XMLResponseParser(DescribeImagesResponseHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<Set<? extends Image>> describeImagesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
DescribeImagesOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#createImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("CreateImage")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateImage")
|
|
||||||
@XMLResponseParser(ImageIdHandler.class)
|
|
||||||
ListenableFuture<String> createImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("Name") String name, @FormParam("InstanceId") String instanceId, CreateImageOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#deregisterImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("DeregisterImage")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DeregisterImage")
|
|
||||||
ListenableFuture<Void> deregisterImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("ImageId") String imageId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#registerImageFromManifestInRegion
|
|
||||||
*/
|
|
||||||
@Named("RegisterImage")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "RegisterImage")
|
|
||||||
@XMLResponseParser(ImageIdHandler.class)
|
|
||||||
ListenableFuture<String> registerImageFromManifestInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest,
|
|
||||||
RegisterImageOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#registerUnixImageBackedByEbsInRegion
|
|
||||||
*/
|
|
||||||
@Named("RegisterImage")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "RootDeviceName", "BlockDeviceMapping.0.DeviceName" }, values = { "RegisterImage",
|
|
||||||
"/dev/sda1", "/dev/sda1" })
|
|
||||||
@XMLResponseParser(ImageIdHandler.class)
|
|
||||||
ListenableFuture<String> registerUnixImageBackedByEbsInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("Name") String imageName,
|
|
||||||
@FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId,
|
|
||||||
RegisterImageBackedByEbsOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#resetLaunchPermissionsOnImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("ResetImageAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" })
|
|
||||||
ListenableFuture<Void> resetLaunchPermissionsOnImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("ImageId") String imageId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#addLaunchPermissionsToImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyImageAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "add",
|
|
||||||
"launchPermission" })
|
|
||||||
ListenableFuture<Void> addLaunchPermissionsToImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
|
||||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
|
||||||
@FormParam("ImageId") String imageId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#removeLaunchPermissionsToImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyImageAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "remove",
|
|
||||||
"launchPermission" })
|
|
||||||
ListenableFuture<Void> removeLaunchPermissionsFromImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
|
||||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
|
||||||
@FormParam("ImageId") String imageId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getLaunchPermissionForImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeImageAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "launchPermission" })
|
|
||||||
@XMLResponseParser(PermissionHandler.class)
|
|
||||||
ListenableFuture<Permission> getLaunchPermissionForImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("ImageId") String imageId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getBlockDeviceMappingsForImageInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeImageAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "blockDeviceMapping" })
|
|
||||||
@XMLResponseParser(BlockDeviceMappingHandler.class)
|
|
||||||
ListenableFuture<Map<String, EbsBlockDevice>> getBlockDeviceMappingsForImageInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("ImageId") String imageId);
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
|
||||||
import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
|
|
||||||
import org.jclouds.ec2.options.DescribeRegionsOptions;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides EC2 Availability Zones and Regions services for EC2.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public interface AvailabilityZoneAndRegionClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays Availability Zones that are currently available to the identity and their states.
|
|
||||||
*
|
|
||||||
* @see InstanceClient#runInstances
|
|
||||||
* @see #describeRegions
|
|
||||||
*
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
Set<AvailabilityZoneInfo> describeAvailabilityZonesInRegion(@Nullable String region,
|
|
||||||
DescribeAvailabilityZonesOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Describes Regions that are currently available to the identity.
|
|
||||||
*
|
|
||||||
* @see InstanceClient#runInstances
|
|
||||||
* @see #describeAvailabilityZones
|
|
||||||
*
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRegions.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
Map<String, URI> describeRegions(DescribeRegionsOptions... options);
|
|
||||||
}
|
|
|
@ -1,239 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.EC2Fallbacks.VoidOnVolumeAvailable;
|
|
||||||
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindVolumeIdsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
|
||||||
import org.jclouds.ec2.domain.Permission;
|
|
||||||
import org.jclouds.ec2.domain.Snapshot;
|
|
||||||
import org.jclouds.ec2.domain.Volume;
|
|
||||||
import org.jclouds.ec2.options.CreateSnapshotOptions;
|
|
||||||
import org.jclouds.ec2.options.DescribeSnapshotsOptions;
|
|
||||||
import org.jclouds.ec2.options.DetachVolumeOptions;
|
|
||||||
import org.jclouds.ec2.xml.AttachmentHandler;
|
|
||||||
import org.jclouds.ec2.xml.CreateVolumeResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.DescribeSnapshotsResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.DescribeVolumesResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.PermissionHandler;
|
|
||||||
import org.jclouds.ec2.xml.SnapshotHandler;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 Elastic Block Store services via their REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface ElasticBlockStoreAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#createVolumeFromSnapshotInAvailabilityZone
|
|
||||||
*/
|
|
||||||
@Named("CreateVolume")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateVolume")
|
|
||||||
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
|
||||||
ListenableFuture<Volume> createVolumeFromSnapshotInAvailabilityZone(
|
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @FormParam("AvailabilityZone") String availabilityZone,
|
|
||||||
@FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#createVolumeFromSnapshotInAvailabilityZone
|
|
||||||
*/
|
|
||||||
@Named("CreateVolume")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateVolume")
|
|
||||||
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
|
||||||
ListenableFuture<Volume> createVolumeFromSnapshotInAvailabilityZone(
|
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @FormParam("AvailabilityZone") String availabilityZone,
|
|
||||||
@FormParam("Size") int size, @FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#createVolumeInAvailabilityZone
|
|
||||||
*/
|
|
||||||
@Named("CreateVolume")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateVolume")
|
|
||||||
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
|
||||||
ListenableFuture<Volume> createVolumeInAvailabilityZone(
|
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @FormParam("AvailabilityZone") String availabilityZone,
|
|
||||||
@FormParam("Size") int size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#describeVolumesInRegion
|
|
||||||
*/
|
|
||||||
@POST
|
|
||||||
@Named("DescribeVolumes")
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeVolumes")
|
|
||||||
@XMLResponseParser(DescribeVolumesResponseHandler.class)
|
|
||||||
ListenableFuture<? extends Set<Volume>> describeVolumesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindVolumeIdsToIndexedFormParams.class) String... volumeIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#deleteVolumeInRegion
|
|
||||||
*/
|
|
||||||
@Named("DeleteVolume")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DeleteVolume")
|
|
||||||
ListenableFuture<Void> deleteVolumeInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("VolumeId") String volumeId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#detachVolumeInRegion
|
|
||||||
*/
|
|
||||||
@Named("DetachVolume")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DetachVolume")
|
|
||||||
@Fallback(VoidOnVolumeAvailable.class)
|
|
||||||
ListenableFuture<Void> detachVolumeInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force, DetachVolumeOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#attachVolumeInRegion
|
|
||||||
*/
|
|
||||||
@Named("AttachVolume")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "AttachVolume")
|
|
||||||
@XMLResponseParser(AttachmentHandler.class)
|
|
||||||
ListenableFuture<Attachment> attachVolumeInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("VolumeId") String volumeId, @FormParam("InstanceId") String instanceId,
|
|
||||||
@FormParam("Device") String device);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#createSnapshotInRegion
|
|
||||||
*/
|
|
||||||
@Named("CreateSnapshot")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateSnapshot")
|
|
||||||
@XMLResponseParser(SnapshotHandler.class)
|
|
||||||
ListenableFuture<Snapshot> createSnapshotInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("VolumeId") String volumeId, CreateSnapshotOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#describeSnapshotsInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeSnapshots")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeSnapshots")
|
|
||||||
@XMLResponseParser(DescribeSnapshotsResponseHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends Set<Snapshot>> describeSnapshotsInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
DescribeSnapshotsOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#deleteSnapshotInRegion
|
|
||||||
*/
|
|
||||||
@Named("DeleteSnapshot")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DeleteSnapshot")
|
|
||||||
ListenableFuture<Void> deleteSnapshotInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#addCreateVolumePermissionsToSnapshotInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifySnapshotAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifySnapshotAttribute", "add",
|
|
||||||
"createVolumePermission" })
|
|
||||||
ListenableFuture<Void> addCreateVolumePermissionsToSnapshotInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
|
||||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
|
||||||
@FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#removeCreateVolumePermissionsFromSnapshotInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifySnapshotAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifySnapshotAttribute", "remove",
|
|
||||||
"createVolumePermission" })
|
|
||||||
ListenableFuture<Void> removeCreateVolumePermissionsFromSnapshotInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
|
||||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
|
||||||
@FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#getCreateVolumePermissionForSnapshotInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeSnapshotAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeSnapshotAttribute", "createVolumePermission" })
|
|
||||||
@XMLResponseParser(PermissionHandler.class)
|
|
||||||
ListenableFuture<Permission> getCreateVolumePermissionForSnapshotInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ElasticBlockStoreClient#resetCreateVolumePermissionsOnSnapshotInRegion
|
|
||||||
*/
|
|
||||||
@Named("ResetSnapshotAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetSnapshotAttribute", "createVolumePermission" })
|
|
||||||
ListenableFuture<Void> resetCreateVolumePermissionsOnSnapshotInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("SnapshotId") String snapshotId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindPublicIpsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
|
||||||
import org.jclouds.ec2.xml.AllocateAddressResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.DescribeAddressesResponseHandler;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 Elastic IP Addresses via REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface ElasticIPAddressAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEC2Client#allocateAddressInRegion
|
|
||||||
*/
|
|
||||||
@Named("AllocateAddress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@XMLResponseParser(AllocateAddressResponseHandler.class)
|
|
||||||
@FormParams(keys = ACTION, values = "AllocateAddress")
|
|
||||||
ListenableFuture<String> allocateAddressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEC2Client#associateAddressInRegion
|
|
||||||
*/
|
|
||||||
@Named("AssociateAddress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "AssociateAddress")
|
|
||||||
ListenableFuture<Void> associateAddressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("PublicIp") String publicIp, @FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEC2Client#disassociateAddressInRegion
|
|
||||||
*/
|
|
||||||
@Named("DisassociateAddress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DisassociateAddress")
|
|
||||||
ListenableFuture<Void> disassociateAddressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("PublicIp") String publicIp);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEC2Client#releaseAddressInRegion
|
|
||||||
*/
|
|
||||||
@Named("ReleaseAddress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "ReleaseAddress")
|
|
||||||
ListenableFuture<Void> releaseAddressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("PublicIp") String publicIp);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEC2Client#describeAddressesInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeAddresses")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeAddresses")
|
|
||||||
@XMLResponseParser(DescribeAddressesResponseHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindPublicIpsToIndexedFormParams.class) String... publicIps);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,361 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindBlockDeviceMappingToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindInstanceIdsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.IfNotNullBindAvailabilityZoneToFormParam;
|
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
|
||||||
import org.jclouds.ec2.domain.InstanceStateChange;
|
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
|
||||||
import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
|
|
||||||
import org.jclouds.ec2.functions.ConvertUnencodedBytesToBase64EncodedString;
|
|
||||||
import org.jclouds.ec2.options.RunInstancesOptions;
|
|
||||||
import org.jclouds.ec2.xml.BlockDeviceMappingHandler;
|
|
||||||
import org.jclouds.ec2.xml.BooleanValueHandler;
|
|
||||||
import org.jclouds.ec2.xml.DescribeInstancesResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.GetConsoleOutputResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.InstanceInitiatedShutdownBehaviorHandler;
|
|
||||||
import org.jclouds.ec2.xml.InstanceStateChangeHandler;
|
|
||||||
import org.jclouds.ec2.xml.InstanceTypeHandler;
|
|
||||||
import org.jclouds.ec2.xml.RunInstancesResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.StringValueHandler;
|
|
||||||
import org.jclouds.ec2.xml.UnencodeStringValueHandler;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.ParamParser;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 Instance Services via their REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface InstanceAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#describeInstancesInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstances")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeInstances")
|
|
||||||
@XMLResponseParser(DescribeInstancesResponseHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends Set<? extends Reservation<? extends RunningInstance>>> describeInstancesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#runInstancesInRegion
|
|
||||||
*/
|
|
||||||
@Named("RunInstances")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "RunInstances")
|
|
||||||
@XMLResponseParser(RunInstancesResponseHandler.class)
|
|
||||||
ListenableFuture<? extends Reservation<? extends RunningInstance>> runInstancesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@Nullable @BinderParam(IfNotNullBindAvailabilityZoneToFormParam.class) String nullableAvailabilityZone,
|
|
||||||
@FormParam("ImageId") String imageId, @FormParam("MinCount") int minCount,
|
|
||||||
@FormParam("MaxCount") int maxCount, RunInstancesOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#rebootInstancesInRegion
|
|
||||||
*/
|
|
||||||
@Named("RebootInstances")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "RebootInstances")
|
|
||||||
ListenableFuture<Void> rebootInstancesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#terminateInstancesInRegion
|
|
||||||
*/
|
|
||||||
@Named("TerminateInstances")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "TerminateInstances")
|
|
||||||
@XMLResponseParser(InstanceStateChangeHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<Set<? extends InstanceStateChange>> terminateInstancesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#stopInstancesInRegion
|
|
||||||
*/
|
|
||||||
@Named("StopInstances")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "StopInstances")
|
|
||||||
@XMLResponseParser(InstanceStateChangeHandler.class)
|
|
||||||
ListenableFuture<Set<? extends InstanceStateChange>> stopInstancesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("Force") boolean force,
|
|
||||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#startInstancesInRegion
|
|
||||||
*/
|
|
||||||
@Named("StartInstances")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "StartInstances")
|
|
||||||
@XMLResponseParser(InstanceStateChangeHandler.class)
|
|
||||||
ListenableFuture<Set<? extends InstanceStateChange>> startInstancesInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getUserDataForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "userData" })
|
|
||||||
@XMLResponseParser(UnencodeStringValueHandler.class)
|
|
||||||
ListenableFuture<String> getUserDataForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getRootDeviceNameForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "rootDeviceName" })
|
|
||||||
@XMLResponseParser(StringValueHandler.class)
|
|
||||||
ListenableFuture<String> getRootDeviceNameForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getRamdiskForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "ramdisk" })
|
|
||||||
@XMLResponseParser(StringValueHandler.class)
|
|
||||||
ListenableFuture<String> getRamdiskForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getKernelForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "kernel" })
|
|
||||||
@XMLResponseParser(StringValueHandler.class)
|
|
||||||
ListenableFuture<String> getKernelForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#isApiTerminationDisabledForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "disableApiTermination" })
|
|
||||||
@XMLResponseParser(BooleanValueHandler.class)
|
|
||||||
ListenableFuture<Boolean> isApiTerminationDisabledForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getInstanceTypeForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "instanceType" })
|
|
||||||
@XMLResponseParser(InstanceTypeHandler.class)
|
|
||||||
ListenableFuture<String> getInstanceTypeForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#getInstanceInitiatedShutdownBehaviorForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
|
||||||
"instanceInitiatedShutdownBehavior" })
|
|
||||||
@XMLResponseParser(InstanceInitiatedShutdownBehaviorHandler.class)
|
|
||||||
ListenableFuture<InstanceInitiatedShutdownBehavior> getInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#getBlockDeviceMappingForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "blockDeviceMapping" })
|
|
||||||
@XMLResponseParser(BlockDeviceMappingHandler.class)
|
|
||||||
ListenableFuture<? extends Map<String, BlockDevice>> getBlockDeviceMappingForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#resetRamdiskForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ResetInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "ramdisk" })
|
|
||||||
ListenableFuture<Void> resetRamdiskForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#resetKernelForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ResetInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "kernel" })
|
|
||||||
ListenableFuture<Void> resetKernelForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#setUserDataForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "userData" })
|
|
||||||
ListenableFuture<Void> setUserDataForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId,
|
|
||||||
@FormParam("Value") @ParamParser(ConvertUnencodedBytesToBase64EncodedString.class) byte[] unencodedData);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#setRamdiskForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "ramdisk" })
|
|
||||||
ListenableFuture<Void> setRamdiskForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId, @FormParam("Value") String ramdisk);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#setKernelForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "kernel" })
|
|
||||||
ListenableFuture<Void> setKernelForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId, @FormParam("Value") String kernel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#setApiTerminationDisabledForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "disableApiTermination" })
|
|
||||||
ListenableFuture<Void> setApiTerminationDisabledForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId, @FormParam("Value") boolean apiTerminationDisabled);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#setInstanceTypeForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceType" })
|
|
||||||
ListenableFuture<Void> setInstanceTypeForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId, @FormParam("Value") String instanceType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AMIClient#setInstanceInitiatedShutdownBehaviorForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
|
|
||||||
"instanceInitiatedShutdownBehavior" })
|
|
||||||
ListenableFuture<Void> setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId,
|
|
||||||
@FormParam("Value") InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#setBlockDeviceMappingForInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("ModifyInstanceAttribute")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION }, values = { "ModifyInstanceAttribute" })
|
|
||||||
ListenableFuture<Void> setBlockDeviceMappingForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId,
|
|
||||||
@BinderParam(BindBlockDeviceMappingToIndexedFormParams.class) Map<String, BlockDevice> blockDeviceMapping);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InstanceClient#getConsoleOutputForInstanceInRegion(String, String)
|
|
||||||
*/
|
|
||||||
@Named("GetConsoleOutput")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = { ACTION }, values = { "GetConsoleOutput" })
|
|
||||||
@XMLResponseParser(GetConsoleOutputResponseHandler.class)
|
|
||||||
ListenableFuture<String> getConsoleOutputForInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import org.jclouds.ec2.domain.KeyPair;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 via their REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public interface KeyPairClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new 2048-bit RSA key pair with the specified name. The public key is stored by
|
|
||||||
* Amazon EC2 and the private key is displayed on the console. The private key is returned as an
|
|
||||||
* unencrypted PEM encoded PKCS#8 private key. If a key with the specified name already exists,
|
|
||||||
* Amazon EC2 returns an error.
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* Key pairs (to connect to instances) are Region-specific.
|
|
||||||
* @param keyName
|
|
||||||
* A unique name for the key pair.
|
|
||||||
*
|
|
||||||
* @see #runInstances
|
|
||||||
* @see #describeKeyPairs
|
|
||||||
* @see #deleteKeyPair
|
|
||||||
*
|
|
||||||
* @see <a href=
|
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateKeyPair.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
KeyPair createKeyPairInRegion(@Nullable String region, String keyName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns information about key pairs available to you. If you specify key pairs, information
|
|
||||||
* about those key pairs is returned. Otherwise, information for all registered key pairs is
|
|
||||||
* returned.
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* Key pairs (to connect to instances) are Region-specific.
|
|
||||||
* @param keyPairNames
|
|
||||||
* Key pairs to describe.
|
|
||||||
*
|
|
||||||
* @see #runInstances
|
|
||||||
* @see #describeAvailabilityZones
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
Set<KeyPair> describeKeyPairsInRegion(@Nullable String region, String... keyPairNames);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes the specified key pair, by removing the public key from Amazon EC2. You must own the
|
|
||||||
* key pair
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* Key pairs (to connect to instances) are Region-specific.
|
|
||||||
* @param keyName
|
|
||||||
* Name of the key pair to delete
|
|
||||||
*
|
|
||||||
* @see #describeKeyPairs
|
|
||||||
* @see #createKeyPair
|
|
||||||
*
|
|
||||||
* @see <a href=
|
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteKeyPair.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
void deleteKeyPairInRegion(@Nullable String region, String keyName);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,145 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|
||||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindGroupNamesToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams;
|
|
||||||
import org.jclouds.ec2.domain.SecurityGroup;
|
|
||||||
import org.jclouds.ec2.domain.UserIdGroupPair;
|
|
||||||
import org.jclouds.ec2.xml.DescribeSecurityGroupsResponseHandler;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.net.domain.IpProtocol;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 via their REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface SecurityGroupAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#createSecurityGroupInRegion
|
|
||||||
*/
|
|
||||||
@Named("CreateSecurityGroup")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CreateSecurityGroup")
|
|
||||||
ListenableFuture<Void> createSecurityGroupInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("GroupName") String name, @FormParam("GroupDescription") String description);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#deleteSecurityGroupInRegion
|
|
||||||
*/
|
|
||||||
@Named("DeleteSecurityGroup")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DeleteSecurityGroup")
|
|
||||||
@Fallback(VoidOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<Void> deleteSecurityGroupInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @FormParam("GroupName") String name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#describeSecurityGroupsInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeSecurityGroups")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeSecurityGroups")
|
|
||||||
@XMLResponseParser(DescribeSecurityGroupsResponseHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends Set<SecurityGroup>> describeSecurityGroupsInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindGroupNamesToIndexedFormParams.class) String... securityGroupNames);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#authorizeSecurityGroupIngressInRegion(@ org.jclouds.javax.annotation.Nullable Region,
|
|
||||||
* String,UserIdGroupPair)
|
|
||||||
*/
|
|
||||||
@Named("AuthorizeSecurityGroupIngress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
|
|
||||||
ListenableFuture<Void> authorizeSecurityGroupIngressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("GroupName") String groupName,
|
|
||||||
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#authorizeSecurityGroupIngressInRegion(@ org.jclouds.javax.annotation.Nullable Region,
|
|
||||||
* String,IpProtocol,int,int,String)
|
|
||||||
*/
|
|
||||||
@Named("AuthorizeSecurityGroupIngress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
|
|
||||||
ListenableFuture<Void> authorizeSecurityGroupIngressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol,
|
|
||||||
@FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#revokeSecurityGroupIngressInRegion(@Nullable Region,
|
|
||||||
* String,UserIdGroupPair)
|
|
||||||
*/
|
|
||||||
@Named("RevokeSecurityGroupIngress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
|
|
||||||
ListenableFuture<Void> revokeSecurityGroupIngressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("GroupName") String groupName,
|
|
||||||
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SecurityGroupClient#revokeSecurityGroupIngressInRegion(@ org.jclouds.javax.annotation.Nullable Region,
|
|
||||||
* String,IpProtocol,int,int,String)
|
|
||||||
*/
|
|
||||||
@Named("RevokeSecurityGroupIngress")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
|
|
||||||
ListenableFuture<Void> revokeSecurityGroupIngressInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol,
|
|
||||||
@FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp);
|
|
||||||
}
|
|
|
@ -1,112 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.ws.rs.FormParam;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
|
||||||
import org.jclouds.ec2.binders.BindBundleIdsToIndexedFormParams;
|
|
||||||
import org.jclouds.ec2.binders.BindS3UploadPolicyAndSignature;
|
|
||||||
import org.jclouds.ec2.domain.BundleTask;
|
|
||||||
import org.jclouds.ec2.domain.PasswordData;
|
|
||||||
import org.jclouds.ec2.options.BundleInstanceS3StorageOptions;
|
|
||||||
import org.jclouds.ec2.xml.BundleTaskHandler;
|
|
||||||
import org.jclouds.ec2.xml.DescribeBundleTasksResponseHandler;
|
|
||||||
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.FormParams;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to EC2 Windows via their REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequestFilters(FormSigner.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface WindowsAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see WindowsClient#bundleInstanceInRegion
|
|
||||||
*/
|
|
||||||
@Named("BundleInstance")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "BundleInstance")
|
|
||||||
@XMLResponseParser(BundleTaskHandler.class)
|
|
||||||
ListenableFuture<BundleTask> bundleInstanceInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId, @FormParam("Storage.S3.Prefix") String prefix,
|
|
||||||
@FormParam("Storage.S3.Bucket") String bucket,
|
|
||||||
@BinderParam(BindS3UploadPolicyAndSignature.class) String uploadPolicy,
|
|
||||||
BundleInstanceS3StorageOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see WindowsClient#cancelBundleTaskInRegion
|
|
||||||
*/
|
|
||||||
@Named("CancelBundleTask")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "CancelBundleTask")
|
|
||||||
@XMLResponseParser(BundleTaskHandler.class)
|
|
||||||
ListenableFuture<BundleTask> cancelBundleTaskInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("BundleId") String bundleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BundleTaskClient#describeBundleTasksInRegion
|
|
||||||
*/
|
|
||||||
@Named("DescribeBundleTasks")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "DescribeBundleTasks")
|
|
||||||
@XMLResponseParser(DescribeBundleTasksResponseHandler.class)
|
|
||||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends Set<BundleTask>> describeBundleTasksInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@BinderParam(BindBundleIdsToIndexedFormParams.class) String... bundleTaskIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see WindowsClient#getPasswordDataInRegion
|
|
||||||
*/
|
|
||||||
@Named("GetPasswordData")
|
|
||||||
@POST
|
|
||||||
@Path("/")
|
|
||||||
@FormParams(keys = ACTION, values = "GetPasswordData")
|
|
||||||
@XMLResponseParser(GetPasswordDataResponseHandler.class)
|
|
||||||
ListenableFuture<PasswordData> getPasswordDataInRegion(
|
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
|
||||||
@FormParam("InstanceId") String instanceId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,116 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2.services;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import org.jclouds.ec2.domain.BundleTask;
|
|
||||||
import org.jclouds.ec2.domain.PasswordData;
|
|
||||||
import org.jclouds.ec2.options.BundleInstanceS3StorageOptions;
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides windows services for EC2. For more information, refer to the Amazon
|
|
||||||
* EC2 Developer Guide.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public interface WindowsClient {
|
|
||||||
/**
|
|
||||||
* Bundles the Windows instance. This procedure is not applicable for Linux
|
|
||||||
* and UNIX instances. For more information, go to the Amazon Elastic Compute
|
|
||||||
* Cloud Developer Guide or Amazon Elastic Compute Cloud Getting Started
|
|
||||||
* Guide.
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* Bundles are tied to the Region where its files are located
|
|
||||||
* within Amazon S3.
|
|
||||||
*
|
|
||||||
* @param instanceId
|
|
||||||
* The ID of the instance to bundle.
|
|
||||||
* @param prefix
|
|
||||||
* Specifies the beginning of the file name of the AMI.
|
|
||||||
* @param bucket
|
|
||||||
* The bucket in which to store the AMI. You can specify a bucket
|
|
||||||
* that you already own or a new bucket that Amazon EC2 creates on
|
|
||||||
* your behalf. If you specify a bucket that belongs to someone
|
|
||||||
* else, Amazon EC2 returns an error.
|
|
||||||
* @param uploadPolicy
|
|
||||||
* An Amazon S3 upload policy that gives Amazon EC2 permission to
|
|
||||||
* upload items into Amazon S3 on the user's behalf.
|
|
||||||
* <p/>
|
|
||||||
* ex.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* {"expiration": "2008-08-30T08:49:09Z","conditions": ["bucket": "my-bucket"},["starts-with", "$key", "my-new-image"]]}
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* if the bucket isn't owned by you, use this to set the bucket's
|
|
||||||
* accesskeyid
|
|
||||||
* @return status of the work
|
|
||||||
*
|
|
||||||
* @see #cancelBundleTaskInRegion
|
|
||||||
* @see #describeBundleTasksInRegion
|
|
||||||
*
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-BundleInstance.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
BundleTask bundleInstanceInRegion(@Nullable String region, String instanceId, String prefix, String bucket,
|
|
||||||
String uploadPolicy, BundleInstanceS3StorageOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancels an Amazon EC2 bundling operation.
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* The bundleTask ID is tied to the Region.
|
|
||||||
* @param bundleId
|
|
||||||
* The ID of the bundle task to cancel.
|
|
||||||
* @return task for the cancel.
|
|
||||||
*
|
|
||||||
* @see #bundleInstanceInRegion
|
|
||||||
* @see #describeBundleTasksInRegion
|
|
||||||
*
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CancelBundleTask.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
BundleTask cancelBundleTaskInRegion(@Nullable String region, String bundleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Describes current bundling tasks.
|
|
||||||
*
|
|
||||||
* @param region
|
|
||||||
* The bundleTask ID is tied to the Region.
|
|
||||||
*
|
|
||||||
* @see #cancelBundleTaskInRegion
|
|
||||||
* @see #bundleInstanceInRegion
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeBundleTasks.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
Set<BundleTask> describeBundleTasksInRegion(@Nullable String region, String... bundleTaskIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Retrieves the encrypted administrator password for the instances running Windows.
|
|
||||||
*
|
|
||||||
* @param region The region where the instance is based
|
|
||||||
* @param instanceId The ID of the instance to query
|
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html" />
|
|
||||||
*/
|
|
||||||
PasswordData getPasswordDataInRegion(@Nullable String region, String instanceId);
|
|
||||||
}
|
|
|
@ -23,9 +23,9 @@ import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
|
import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
||||||
|
@ -45,12 +45,12 @@ public class DescribeAvailabilityZonesInRegion implements RegionIdToZoneIdsSuppl
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final AvailabilityZoneAndRegionClient client;
|
private final AvailabilityZoneAndRegionApi client;
|
||||||
private final Supplier<Set<String>> regions;
|
private final Supplier<Set<String>> regions;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DescribeAvailabilityZonesInRegion(EC2Client client, @Region Supplier<Set<String>> regions) {
|
public DescribeAvailabilityZonesInRegion(EC2Api client, @Region Supplier<Set<String>> regions) {
|
||||||
this.client = client.getAvailabilityZoneAndRegionServices();
|
this.client = client.getAvailabilityZoneAndRegionApi().get();
|
||||||
this.regions = regions;
|
this.regions = regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
|
import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
||||||
import org.jclouds.util.Suppliers2;
|
import org.jclouds.util.Suppliers2;
|
||||||
|
@ -33,11 +33,11 @@ import com.google.common.collect.Maps;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DescribeRegionsForRegionURIs implements RegionIdToURISupplier {
|
public class DescribeRegionsForRegionURIs implements RegionIdToURISupplier {
|
||||||
private final AvailabilityZoneAndRegionClient client;
|
private final AvailabilityZoneAndRegionApi client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DescribeRegionsForRegionURIs(EC2Client client) {
|
public DescribeRegionsForRegionURIs(EC2Api client) {
|
||||||
this.client = client.getAvailabilityZoneAndRegionServices();
|
this.client = client.getAvailabilityZoneAndRegionApi().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|
|
@ -74,13 +74,13 @@ import com.google.inject.Injector;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", enabled = false, singleThreaded = true, testName = "CloudApplicationArchitecturesEC2ClientLiveTest")
|
@Test(groups = "live", enabled = false, singleThreaded = true, testName = "CloudApplicationArchitecturesEC2ApiLiveTest")
|
||||||
public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class CloudApplicationArchitecturesEC2ApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
public CloudApplicationArchitecturesEC2ClientLiveTest() {
|
public CloudApplicationArchitecturesEC2ApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
private EC2Client client;
|
private EC2Api client;
|
||||||
protected SshClient.Factory sshFactory;
|
protected SshClient.Factory sshFactory;
|
||||||
private String instancePrefix = System.getProperty("user.name") + ".ec2";
|
private String instancePrefix = System.getProperty("user.name") + ".ec2";
|
||||||
private KeyPair keyPair;
|
private KeyPair keyPair;
|
||||||
|
@ -96,7 +96,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
Injector injector = view.utils().injector();
|
Injector injector = view.utils().injector();
|
||||||
client = injector.getInstance(EC2Client.class);
|
client = injector.getInstance(EC2Api.class);
|
||||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||||
runningTester = retry(new InstanceStateRunning(client), 180, 5,SECONDS);
|
runningTester = retry(new InstanceStateRunning(client), 180, 5,SECONDS);
|
||||||
hasIpTester = retry(new InstanceHasIpAddress(client), 180, 5, SECONDS);
|
hasIpTester = retry(new InstanceHasIpAddress(client), 180, 5, SECONDS);
|
||||||
|
@ -109,13 +109,13 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
securityGroupName = instancePrefix + "ingress";
|
securityGroupName = instancePrefix + "ingress";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
client.getSecurityGroupServices().createSecurityGroupInRegion(null, securityGroupName, securityGroupName);
|
client.getSecurityGroupApi().get().createSecurityGroupInRegion(null, securityGroupName, securityGroupName);
|
||||||
for (int port : new int[] { 80, 443, 22 }) {
|
for (int port : new int[] { 80, 443, 22 }) {
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null, securityGroupName,
|
client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(null, securityGroupName,
|
||||||
IpProtocol.TCP, port, port, "0.0.0.0/0");
|
IpProtocol.TCP, port, port, "0.0.0.0/0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,13 +124,13 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
void testCreateKeyPair() throws InterruptedException, ExecutionException, TimeoutException {
|
void testCreateKeyPair() throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
String keyName = instancePrefix + "1";
|
String keyName = instancePrefix + "1";
|
||||||
try {
|
try {
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(null, keyName);
|
client.getKeyPairApi().get().deleteKeyPairInRegion(null, keyName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(null, keyName);
|
client.getKeyPairApi().get().deleteKeyPairInRegion(null, keyName);
|
||||||
|
|
||||||
keyPair = client.getKeyPairServices().createKeyPairInRegion(null, keyName);
|
keyPair = client.getKeyPairApi().get().createKeyPairInRegion(null, keyName);
|
||||||
assertNotNull(keyPair);
|
assertNotNull(keyPair);
|
||||||
assertNotNull(keyPair.getKeyMaterial());
|
assertNotNull(keyPair.getKeyMaterial());
|
||||||
assertNotNull(keyPair.getSha1OfPrivateKey());
|
assertNotNull(keyPair.getSha1OfPrivateKey());
|
||||||
|
@ -149,7 +149,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
try {
|
try {
|
||||||
|
|
||||||
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
||||||
Reservation<? extends RunningInstance> reservation = client.getInstanceServices().runInstancesInRegion(
|
Reservation<? extends RunningInstance> reservation = client.getInstanceApi().get().runInstancesInRegion(
|
||||||
null, null, // allow
|
null, null, // allow
|
||||||
// ec2
|
// ec2
|
||||||
// to
|
// to
|
||||||
|
@ -192,31 +192,31 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyInstanceProperties(String script) {
|
private void verifyInstanceProperties(String script) {
|
||||||
assertEquals(script, client.getInstanceServices().getUserDataForInstanceInRegion(null, instanceId));
|
assertEquals(script, client.getInstanceApi().get().getUserDataForInstanceInRegion(null, instanceId));
|
||||||
|
|
||||||
assertEquals(null, client.getInstanceServices().getRootDeviceNameForInstanceInRegion(null, instanceId));
|
assertEquals(null, client.getInstanceApi().get().getRootDeviceNameForInstanceInRegion(null, instanceId));
|
||||||
|
|
||||||
assert client.getInstanceServices().getRamdiskForInstanceInRegion(null, instanceId).startsWith("ari-");
|
assert client.getInstanceApi().get().getRamdiskForInstanceInRegion(null, instanceId).startsWith("ari-");
|
||||||
|
|
||||||
assertEquals(false, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(null, instanceId));
|
assertEquals(false, client.getInstanceApi().get().isApiTerminationDisabledForInstanceInRegion(null, instanceId));
|
||||||
|
|
||||||
assert client.getInstanceServices().getKernelForInstanceInRegion(null, instanceId).startsWith("aki-");
|
assert client.getInstanceApi().get().getKernelForInstanceInRegion(null, instanceId).startsWith("aki-");
|
||||||
|
|
||||||
assertEquals(InstanceType.M1_SMALL,
|
assertEquals(InstanceType.M1_SMALL,
|
||||||
client.getInstanceServices().getInstanceTypeForInstanceInRegion(null, instanceId));
|
client.getInstanceApi().get().getInstanceTypeForInstanceInRegion(null, instanceId));
|
||||||
|
|
||||||
assertEquals(InstanceInitiatedShutdownBehavior.TERMINATE, client.getInstanceServices()
|
assertEquals(InstanceInitiatedShutdownBehavior.TERMINATE, client.getInstanceApi().get()
|
||||||
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, instanceId));
|
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, instanceId));
|
||||||
|
|
||||||
assertEquals(ImmutableMap.<String, EbsBlockDevice> of(), client.getInstanceServices()
|
assertEquals(ImmutableMap.<String, EbsBlockDevice> of(), client.getInstanceApi().get()
|
||||||
.getBlockDeviceMappingForInstanceInRegion(null, instanceId));
|
.getBlockDeviceMappingForInstanceInRegion(null, instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setApiTerminationDisabledForInstanceInRegion() {
|
private void setApiTerminationDisabledForInstanceInRegion() {
|
||||||
client.getInstanceServices().setApiTerminationDisabledForInstanceInRegion(null, instanceId, true);
|
client.getInstanceApi().get().setApiTerminationDisabledForInstanceInRegion(null, instanceId, true);
|
||||||
assertEquals(true, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(null, instanceId));
|
assertEquals(true, client.getInstanceApi().get().isApiTerminationDisabledForInstanceInRegion(null, instanceId));
|
||||||
client.getInstanceServices().setApiTerminationDisabledForInstanceInRegion(null, instanceId, false);
|
client.getInstanceApi().get().setApiTerminationDisabledForInstanceInRegion(null, instanceId, false);
|
||||||
assertEquals(false, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(null, instanceId));
|
assertEquals(false, client.getInstanceApi().get().isApiTerminationDisabledForInstanceInRegion(null, instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryToChangeStuff() {
|
private void tryToChangeStuff() {
|
||||||
|
@ -231,7 +231,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
private void setUserDataForInstanceInRegion() {
|
private void setUserDataForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setUserDataForInstanceInRegion(null, instanceId, "test".getBytes());
|
client.getInstanceApi().get().setUserDataForInstanceInRegion(null, instanceId, "test".getBytes());
|
||||||
fail("shouldn't be allowed, as instance needs to be stopped");
|
fail("shouldn't be allowed, as instance needs to be stopped");
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -240,8 +240,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
private void setRamdiskForInstanceInRegion() {
|
private void setRamdiskForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
String ramdisk = client.getInstanceServices().getRamdiskForInstanceInRegion(null, instanceId);
|
String ramdisk = client.getInstanceApi().get().getRamdiskForInstanceInRegion(null, instanceId);
|
||||||
client.getInstanceServices().setRamdiskForInstanceInRegion(null, instanceId, ramdisk);
|
client.getInstanceApi().get().setRamdiskForInstanceInRegion(null, instanceId, ramdisk);
|
||||||
fail("shouldn't be allowed, as instance needs to be stopped");
|
fail("shouldn't be allowed, as instance needs to be stopped");
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -250,8 +250,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
private void setKernelForInstanceInRegion() {
|
private void setKernelForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
String oldKernel = client.getInstanceServices().getKernelForInstanceInRegion(null, instanceId);
|
String oldKernel = client.getInstanceApi().get().getKernelForInstanceInRegion(null, instanceId);
|
||||||
client.getInstanceServices().setKernelForInstanceInRegion(null, instanceId, oldKernel);
|
client.getInstanceApi().get().setKernelForInstanceInRegion(null, instanceId, oldKernel);
|
||||||
fail("shouldn't be allowed, as instance needs to be stopped");
|
fail("shouldn't be allowed, as instance needs to be stopped");
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -260,7 +260,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
private void setInstanceTypeForInstanceInRegion() {
|
private void setInstanceTypeForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null, instanceId, InstanceType.C1_MEDIUM);
|
client.getInstanceApi().get().setInstanceTypeForInstanceInRegion(null, instanceId, InstanceType.C1_MEDIUM);
|
||||||
fail("shouldn't be allowed, as instance needs to be stopped");
|
fail("shouldn't be allowed, as instance needs to be stopped");
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -270,7 +270,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
private void setBlockDeviceMappingForInstanceInRegion() {
|
private void setBlockDeviceMappingForInstanceInRegion() {
|
||||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setBlockDeviceMappingForInstanceInRegion(null, instanceId, mapping);
|
client.getInstanceApi().get().setBlockDeviceMappingForInstanceInRegion(null, instanceId, mapping);
|
||||||
fail("shouldn't be allowed, as instance needs to be ebs based-ami");
|
fail("shouldn't be allowed, as instance needs to be ebs based-ami");
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("InvalidParameterCombination", e.getError().getCode());
|
assertEquals("InvalidParameterCombination", e.getError().getCode());
|
||||||
|
@ -279,7 +279,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, instanceId,
|
client.getInstanceApi().get().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, instanceId,
|
||||||
InstanceInitiatedShutdownBehavior.STOP);
|
InstanceInitiatedShutdownBehavior.STOP);
|
||||||
fail("shouldn't be allowed, as instance needs to be ebs based-ami");
|
fail("shouldn't be allowed, as instance needs to be ebs based-ami");
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
|
@ -291,7 +291,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
void testReboot() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
void testReboot() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
||||||
RunningInstance instance = getInstance(instanceId);
|
RunningInstance instance = getInstance(instanceId);
|
||||||
System.out.printf("%d: %s rebooting instance %n", System.currentTimeMillis(), instanceId);
|
System.out.printf("%d: %s rebooting instance %n", System.currentTimeMillis(), instanceId);
|
||||||
client.getInstanceServices().rebootInstancesInRegion(null, instanceId);
|
client.getInstanceApi().get().rebootInstancesInRegion(null, instanceId);
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
instance = getInstance(instanceId);
|
instance = getInstance(instanceId);
|
||||||
blockUntilWeCanSshIntoInstance(instance);
|
blockUntilWeCanSshIntoInstance(instance);
|
||||||
|
@ -309,23 +309,23 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
@Test(enabled = false, dependsOnMethods = "testReboot")
|
@Test(enabled = false, dependsOnMethods = "testReboot")
|
||||||
void testElasticIpAddress() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
void testElasticIpAddress() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
||||||
address = client.getElasticIPAddressServices().allocateAddressInRegion(null);
|
address = client.getElasticIPAddressApi().get().allocateAddressInRegion(null);
|
||||||
assertNotNull(address);
|
assertNotNull(address);
|
||||||
|
|
||||||
PublicIpInstanceIdPair compare = Iterables.getLast(client.getElasticIPAddressServices()
|
PublicIpInstanceIdPair compare = Iterables.getLast(client.getElasticIPAddressApi().get()
|
||||||
.describeAddressesInRegion(null, address));
|
.describeAddressesInRegion(null, address));
|
||||||
|
|
||||||
assertEquals(compare.getPublicIp(), address);
|
assertEquals(compare.getPublicIp(), address);
|
||||||
assert compare.getInstanceId() == null;
|
assert compare.getInstanceId() == null;
|
||||||
|
|
||||||
client.getElasticIPAddressServices().associateAddressInRegion(null, address, instanceId);
|
client.getElasticIPAddressApi().get().associateAddressInRegion(null, address, instanceId);
|
||||||
|
|
||||||
compare = Iterables.getLast(client.getElasticIPAddressServices().describeAddressesInRegion(null, address));
|
compare = Iterables.getLast(client.getElasticIPAddressApi().get().describeAddressesInRegion(null, address));
|
||||||
|
|
||||||
assertEquals(compare.getPublicIp(), address);
|
assertEquals(compare.getPublicIp(), address);
|
||||||
assertEquals(compare.getInstanceId(), instanceId);
|
assertEquals(compare.getInstanceId(), instanceId);
|
||||||
|
|
||||||
Reservation<? extends RunningInstance> reservation = Iterables.getOnlyElement(client.getInstanceServices()
|
Reservation<? extends RunningInstance> reservation = Iterables.getOnlyElement(client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(null, instanceId));
|
.describeInstancesInRegion(null, instanceId));
|
||||||
|
|
||||||
assertNotNull(Iterables.getOnlyElement(reservation).getIpAddress());
|
assertNotNull(Iterables.getOnlyElement(reservation).getIpAddress());
|
||||||
|
@ -333,14 +333,14 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
doCheckKey(address);
|
doCheckKey(address);
|
||||||
|
|
||||||
client.getElasticIPAddressServices().disassociateAddressInRegion(null, address);
|
client.getElasticIPAddressApi().get().disassociateAddressInRegion(null, address);
|
||||||
|
|
||||||
compare = Iterables.getLast(client.getElasticIPAddressServices().describeAddressesInRegion(null, address));
|
compare = Iterables.getLast(client.getElasticIPAddressApi().get().describeAddressesInRegion(null, address));
|
||||||
|
|
||||||
assertEquals(compare.getPublicIp(), address);
|
assertEquals(compare.getPublicIp(), address);
|
||||||
assert compare.getInstanceId() == null;
|
assert compare.getInstanceId() == null;
|
||||||
|
|
||||||
reservation = Iterables.getOnlyElement(client.getInstanceServices().describeInstancesInRegion(null, instanceId));
|
reservation = Iterables.getOnlyElement(client.getInstanceApi().get().describeInstancesInRegion(null, instanceId));
|
||||||
// assert reservation.getRunningInstances().last().getIpAddress() == null;
|
// assert reservation.getRunningInstances().last().getIpAddress() == null;
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
|
|
||||||
private RunningInstance getInstance(String instanceId) {
|
private RunningInstance getInstance(String instanceId) {
|
||||||
// search my identity for the instance I just created
|
// search my identity for the instance I just created
|
||||||
Set<? extends Reservation<? extends RunningInstance>> reservations = client.getInstanceServices()
|
Set<? extends Reservation<? extends RunningInstance>> reservations = client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(null, instanceId); // last parameter
|
.describeInstancesInRegion(null, instanceId); // last parameter
|
||||||
// (ids) narrows the
|
// (ids) narrows the
|
||||||
// search
|
// search
|
||||||
|
@ -415,13 +415,13 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
||||||
@AfterTest
|
@AfterTest
|
||||||
void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
|
void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
if (address != null)
|
if (address != null)
|
||||||
client.getElasticIPAddressServices().releaseAddressInRegion(null, address);
|
client.getElasticIPAddressApi().get().releaseAddressInRegion(null, address);
|
||||||
if (instanceId != null)
|
if (instanceId != null)
|
||||||
client.getInstanceServices().terminateInstancesInRegion(null, instanceId);
|
client.getInstanceApi().get().terminateInstancesInRegion(null, instanceId);
|
||||||
if (keyPair != null)
|
if (keyPair != null)
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(null, keyPair.getKeyName());
|
client.getKeyPairApi().get().deleteKeyPairInRegion(null, keyPair.getKeyName());
|
||||||
if (securityGroupName != null)
|
if (securityGroupName != null)
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -85,9 +85,9 @@ import com.google.inject.Injector;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", enabled = false, singleThreaded = true, testName = "EBSBootEC2ClientLiveTest")
|
@Test(groups = "live", enabled = false, singleThreaded = true, testName = "EBSBootEC2ApiLiveTest")
|
||||||
public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class EBSBootEC2ApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
public EBSBootEC2ClientLiveTest() {
|
public EBSBootEC2ApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
private static final String SCRIPT_END = "----COMPLETE----";
|
private static final String SCRIPT_END = "----COMPLETE----";
|
||||||
private static final String INSTANCE_PREFIX = System.getProperty("user.name") + ".ec2ebs";
|
private static final String INSTANCE_PREFIX = System.getProperty("user.name") + ".ec2ebs";
|
||||||
|
|
||||||
private EC2Client client;
|
private EC2Api client;
|
||||||
private SshClient.Factory sshFactory;
|
private SshClient.Factory sshFactory;
|
||||||
|
|
||||||
private KeyPair keyPair;
|
private KeyPair keyPair;
|
||||||
|
@ -125,7 +125,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
Injector injector = view.utils().injector();
|
Injector injector = view.utils().injector();
|
||||||
client = injector.getInstance(EC2Client.class);
|
client = injector.getInstance(EC2Api.class);
|
||||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||||
socketTester = retry(socketOpen, 120, 1, SECONDS);
|
socketTester = retry(socketOpen, 120, 1, SECONDS);
|
||||||
|
@ -155,16 +155,16 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
securityGroupName = INSTANCE_PREFIX + "ingress";
|
securityGroupName = INSTANCE_PREFIX + "ingress";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
client.getSecurityGroupServices().createSecurityGroupInRegion(null, securityGroupName, securityGroupName);
|
client.getSecurityGroupApi().get().createSecurityGroupInRegion(null, securityGroupName, securityGroupName);
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null, securityGroupName, IpProtocol.TCP,
|
client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(null, securityGroupName, IpProtocol.TCP,
|
||||||
80, 80, "0.0.0.0/0");
|
80, 80, "0.0.0.0/0");
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null, securityGroupName, IpProtocol.TCP,
|
client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(null, securityGroupName, IpProtocol.TCP,
|
||||||
443, 443, "0.0.0.0/0");
|
443, 443, "0.0.0.0/0");
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null, securityGroupName, IpProtocol.TCP,
|
client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(null, securityGroupName, IpProtocol.TCP,
|
||||||
22, 22, "0.0.0.0/0");
|
22, 22, "0.0.0.0/0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,12 +172,12 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
void testCreateKeyPair() {
|
void testCreateKeyPair() {
|
||||||
String keyName = INSTANCE_PREFIX + "1";
|
String keyName = INSTANCE_PREFIX + "1";
|
||||||
try {
|
try {
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(null, keyName);
|
client.getKeyPairApi().get().deleteKeyPairInRegion(null, keyName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPair = client.getKeyPairServices().createKeyPairInRegion(null, keyName);
|
keyPair = client.getKeyPairApi().get().createKeyPairInRegion(null, keyName);
|
||||||
assertNotNull(keyPair);
|
assertNotNull(keyPair);
|
||||||
assertNotNull(keyPair.getKeyMaterial());
|
assertNotNull(keyPair.getKeyMaterial());
|
||||||
assertNotNull(keyPair.getSha1OfPrivateKey());
|
assertNotNull(keyPair.getSha1OfPrivateKey());
|
||||||
|
@ -194,7 +194,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
while (instance == null) {
|
while (instance == null) {
|
||||||
try {
|
try {
|
||||||
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
||||||
Reservation<? extends RunningInstance> reservation = client.getInstanceServices().runInstancesInRegion(
|
Reservation<? extends RunningInstance> reservation = client.getInstanceApi().get().runInstancesInRegion(
|
||||||
null, null, // allow
|
null, null, // allow
|
||||||
// ec2
|
// ec2
|
||||||
// to
|
// to
|
||||||
|
@ -225,13 +225,13 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
|
|
||||||
@Test(enabled = false, dependsOnMethods = "testCreateRunningInstance")
|
@Test(enabled = false, dependsOnMethods = "testCreateRunningInstance")
|
||||||
void testCreateAndAttachVolume() {
|
void testCreateAndAttachVolume() {
|
||||||
volume = client.getElasticBlockStoreServices().createVolumeInAvailabilityZone(instance.getAvailabilityZone(),
|
volume = client.getElasticBlockStoreApi().get().createVolumeInAvailabilityZone(instance.getAvailabilityZone(),
|
||||||
VOLUME_SIZE);
|
VOLUME_SIZE);
|
||||||
System.out.printf("%d: %s awaiting volume to become available%n", System.currentTimeMillis(), volume.getId());
|
System.out.printf("%d: %s awaiting volume to become available%n", System.currentTimeMillis(), volume.getId());
|
||||||
|
|
||||||
assert volumeTester.apply(volume);
|
assert volumeTester.apply(volume);
|
||||||
|
|
||||||
Attachment attachment = client.getElasticBlockStoreServices().attachVolumeInRegion(instance.getRegion(),
|
Attachment attachment = client.getElasticBlockStoreApi().get().attachVolumeInRegion(instance.getRegion(),
|
||||||
volume.getId(), instance.getId(), "/dev/sdh");
|
volume.getId(), instance.getId(), "/dev/sdh");
|
||||||
|
|
||||||
System.out.printf("%d: %s awaiting attachment to complete%n", System.currentTimeMillis(), attachment.getId());
|
System.out.printf("%d: %s awaiting attachment to complete%n", System.currentTimeMillis(), attachment.getId());
|
||||||
|
@ -334,42 +334,42 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
|
|
||||||
@Test(enabled = false, dependsOnMethods = "testBundleInstance")
|
@Test(enabled = false, dependsOnMethods = "testBundleInstance")
|
||||||
void testAMIFromBundle() {
|
void testAMIFromBundle() {
|
||||||
volume = Iterables.getOnlyElement(client.getElasticBlockStoreServices().describeVolumesInRegion(
|
volume = Iterables.getOnlyElement(client.getElasticBlockStoreApi().get().describeVolumesInRegion(
|
||||||
volume.getRegion(), volume.getId()));
|
volume.getRegion(), volume.getId()));
|
||||||
if (volume.getAttachments().size() > 0) {
|
if (volume.getAttachments().size() > 0) {
|
||||||
// should be cleanly unmounted, so force is not necessary.
|
// should be cleanly unmounted, so force is not necessary.
|
||||||
client.getElasticBlockStoreServices().detachVolumeInRegion(instance.getRegion(), volume.getId(), false);
|
client.getElasticBlockStoreApi().get().detachVolumeInRegion(instance.getRegion(), volume.getId(), false);
|
||||||
System.out.printf("%d: %s awaiting detachment to complete%n", System.currentTimeMillis(), volume.getId());
|
System.out.printf("%d: %s awaiting detachment to complete%n", System.currentTimeMillis(), volume.getId());
|
||||||
assert volumeTester.apply(volume);
|
assert volumeTester.apply(volume);
|
||||||
} else {
|
} else {
|
||||||
attachment = null; // protect test closer so that it doesn't try to
|
attachment = null; // protect test closer so that it doesn't try to
|
||||||
// detach
|
// detach
|
||||||
}
|
}
|
||||||
snapshot = client.getElasticBlockStoreServices().createSnapshotInRegion(volume.getRegion(), volume.getId(),
|
snapshot = client.getElasticBlockStoreApi().get().createSnapshotInRegion(volume.getRegion(), volume.getId(),
|
||||||
withDescription("EBS Ubuntu Hardy"));
|
withDescription("EBS Ubuntu Hardy"));
|
||||||
|
|
||||||
System.out.printf("%d: %s awaiting snapshot to complete%n", System.currentTimeMillis(), snapshot.getId());
|
System.out.printf("%d: %s awaiting snapshot to complete%n", System.currentTimeMillis(), snapshot.getId());
|
||||||
|
|
||||||
assert snapshotTester.apply(snapshot);
|
assert snapshotTester.apply(snapshot);
|
||||||
Image image = Iterables.getOnlyElement(client.getAMIServices().describeImagesInRegion(snapshot.getRegion(),
|
Image image = Iterables.getOnlyElement(client.getAMIApi().get().describeImagesInRegion(snapshot.getRegion(),
|
||||||
imageIds(IMAGE_ID)));
|
imageIds(IMAGE_ID)));
|
||||||
String description = image.getDescription() == null ? "jclouds" : image.getDescription();
|
String description = image.getDescription() == null ? "jclouds" : image.getDescription();
|
||||||
|
|
||||||
System.out.printf("%d: %s creating ami from snapshot%n", System.currentTimeMillis(), snapshot.getId());
|
System.out.printf("%d: %s creating ami from snapshot%n", System.currentTimeMillis(), snapshot.getId());
|
||||||
|
|
||||||
String amiId = client.getAMIServices().registerUnixImageBackedByEbsInRegion(
|
String amiId = client.getAMIApi().get().registerUnixImageBackedByEbsInRegion(
|
||||||
snapshot.getRegion(),
|
snapshot.getRegion(),
|
||||||
"ebsboot-" + image.getId(),
|
"ebsboot-" + image.getId(),
|
||||||
snapshot.getId(),
|
snapshot.getId(),
|
||||||
withKernelId(image.getKernelId()).withRamdisk(image.getRamdiskId()).withDescription(description)
|
withKernelId(image.getKernelId()).withRamdisk(image.getRamdiskId()).withDescription(description)
|
||||||
.asArchitecture(Architecture.I386));
|
.asArchitecture(Architecture.I386));
|
||||||
try {
|
try {
|
||||||
ebsImage = Iterables.getOnlyElement(client.getAMIServices().describeImagesInRegion(snapshot.getRegion(),
|
ebsImage = Iterables.getOnlyElement(client.getAMIApi().get().describeImagesInRegion(snapshot.getRegion(),
|
||||||
imageIds(amiId)));
|
imageIds(amiId)));
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
// TODO add a retry handler for this HTTP code 400 and the below error
|
// TODO add a retry handler for this HTTP code 400 and the below error
|
||||||
if (e.getError().getClass().equals("InvalidAMIID.NotFound"))
|
if (e.getError().getClass().equals("InvalidAMIID.NotFound"))
|
||||||
ebsImage = Iterables.getOnlyElement(client.getAMIServices().describeImagesInRegion(snapshot.getRegion(),
|
ebsImage = Iterables.getOnlyElement(client.getAMIApi().get().describeImagesInRegion(snapshot.getRegion(),
|
||||||
imageIds(amiId)));
|
imageIds(amiId)));
|
||||||
else
|
else
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -383,13 +383,13 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
|
|
||||||
ebsInstance = createInstance(ebsImage.getId());
|
ebsInstance = createInstance(ebsImage.getId());
|
||||||
|
|
||||||
client.getInstanceServices().stopInstancesInRegion(ebsInstance.getRegion(), true, ebsInstance.getId());
|
client.getInstanceApi().get().stopInstancesInRegion(ebsInstance.getRegion(), true, ebsInstance.getId());
|
||||||
|
|
||||||
System.out.printf("%d: %s awaiting instance to stop %n", System.currentTimeMillis(), ebsInstance.getId());
|
System.out.printf("%d: %s awaiting instance to stop %n", System.currentTimeMillis(), ebsInstance.getId());
|
||||||
stoppedTester.apply(ebsInstance);
|
stoppedTester.apply(ebsInstance);
|
||||||
tryToChangeStuff();
|
tryToChangeStuff();
|
||||||
System.out.printf("%d: %s awaiting instance to start %n", System.currentTimeMillis(), ebsInstance.getId());
|
System.out.printf("%d: %s awaiting instance to start %n", System.currentTimeMillis(), ebsInstance.getId());
|
||||||
client.getInstanceServices().startInstancesInRegion(ebsInstance.getRegion(), ebsInstance.getId());
|
client.getInstanceApi().get().startInstancesInRegion(ebsInstance.getRegion(), ebsInstance.getId());
|
||||||
ebsInstance = blockUntilWeCanSshIntoInstance(ebsInstance);
|
ebsInstance = blockUntilWeCanSshIntoInstance(ebsInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,30 +411,30 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUserDataForInstanceInRegion() {
|
private void setUserDataForInstanceInRegion() {
|
||||||
client.getInstanceServices().setUserDataForInstanceInRegion(null, ebsInstance.getId(), "test".getBytes());
|
client.getInstanceApi().get().setUserDataForInstanceInRegion(null, ebsInstance.getId(), "test".getBytes());
|
||||||
assertEquals("test", client.getInstanceServices().getUserDataForInstanceInRegion(null, ebsInstance.getId()));
|
assertEquals("test", client.getInstanceApi().get().getUserDataForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRamdiskForInstanceInRegion() {
|
private void setRamdiskForInstanceInRegion() {
|
||||||
String ramdisk = client.getInstanceServices().getRamdiskForInstanceInRegion(null, ebsInstance.getId());
|
String ramdisk = client.getInstanceApi().get().getRamdiskForInstanceInRegion(null, ebsInstance.getId());
|
||||||
client.getInstanceServices().setRamdiskForInstanceInRegion(null, ebsInstance.getId(), ramdisk);
|
client.getInstanceApi().get().setRamdiskForInstanceInRegion(null, ebsInstance.getId(), ramdisk);
|
||||||
assertEquals(ramdisk, client.getInstanceServices().getRamdiskForInstanceInRegion(null, ebsInstance.getId()));
|
assertEquals(ramdisk, client.getInstanceApi().get().getRamdiskForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setKernelForInstanceInRegion() {
|
private void setKernelForInstanceInRegion() {
|
||||||
String oldKernel = client.getInstanceServices().getKernelForInstanceInRegion(null, ebsInstance.getId());
|
String oldKernel = client.getInstanceApi().get().getKernelForInstanceInRegion(null, ebsInstance.getId());
|
||||||
client.getInstanceServices().setKernelForInstanceInRegion(null, ebsInstance.getId(), oldKernel);
|
client.getInstanceApi().get().setKernelForInstanceInRegion(null, ebsInstance.getId(), oldKernel);
|
||||||
assertEquals(oldKernel, client.getInstanceServices().getKernelForInstanceInRegion(null, ebsInstance.getId()));
|
assertEquals(oldKernel, client.getInstanceApi().get().getKernelForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInstanceTypeForInstanceInRegion() {
|
private void setInstanceTypeForInstanceInRegion() {
|
||||||
client.getInstanceServices()
|
client.getInstanceApi().get()
|
||||||
.setInstanceTypeForInstanceInRegion(null, ebsInstance.getId(), InstanceType.C1_MEDIUM);
|
.setInstanceTypeForInstanceInRegion(null, ebsInstance.getId(), InstanceType.C1_MEDIUM);
|
||||||
assertEquals(InstanceType.C1_MEDIUM,
|
assertEquals(InstanceType.C1_MEDIUM,
|
||||||
client.getInstanceServices().getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
client.getInstanceApi().get().getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null, ebsInstance.getId(), InstanceType.M1_SMALL);
|
client.getInstanceApi().get().setInstanceTypeForInstanceInRegion(null, ebsInstance.getId(), InstanceType.M1_SMALL);
|
||||||
assertEquals(InstanceType.M1_SMALL,
|
assertEquals(InstanceType.M1_SMALL,
|
||||||
client.getInstanceServices().getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
client.getInstanceApi().get().getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBlockDeviceMappingForInstanceInRegion() {
|
private void setBlockDeviceMappingForInstanceInRegion() {
|
||||||
|
@ -443,9 +443,9 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||||
mapping.put("/dev/sda1", new BlockDevice(volumeId, false));
|
mapping.put("/dev/sda1", new BlockDevice(volumeId, false));
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setBlockDeviceMappingForInstanceInRegion(null, ebsInstance.getId(), mapping);
|
client.getInstanceApi().get().setBlockDeviceMappingForInstanceInRegion(null, ebsInstance.getId(), mapping);
|
||||||
|
|
||||||
Map<String, BlockDevice> devices = client.getInstanceServices().getBlockDeviceMappingForInstanceInRegion(null,
|
Map<String, BlockDevice> devices = client.getInstanceApi().get().getBlockDeviceMappingForInstanceInRegion(null,
|
||||||
ebsInstance.getId());
|
ebsInstance.getId());
|
||||||
assertEquals(devices.size(), 1);
|
assertEquals(devices.size(), 1);
|
||||||
String deviceName = Iterables.getOnlyElement(devices.keySet());
|
String deviceName = Iterables.getOnlyElement(devices.keySet());
|
||||||
|
@ -466,15 +466,15 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
client.getInstanceApi().get().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
ebsInstance.getId(), InstanceInitiatedShutdownBehavior.STOP);
|
ebsInstance.getId(), InstanceInitiatedShutdownBehavior.STOP);
|
||||||
|
|
||||||
assertEquals(InstanceInitiatedShutdownBehavior.STOP, client.getInstanceServices()
|
assertEquals(InstanceInitiatedShutdownBehavior.STOP, client.getInstanceApi().get()
|
||||||
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, ebsInstance.getId()));
|
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
client.getInstanceApi().get().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
ebsInstance.getId(), InstanceInitiatedShutdownBehavior.TERMINATE);
|
ebsInstance.getId(), InstanceInitiatedShutdownBehavior.TERMINATE);
|
||||||
|
|
||||||
assertEquals(InstanceInitiatedShutdownBehavior.TERMINATE, client.getInstanceServices()
|
assertEquals(InstanceInitiatedShutdownBehavior.TERMINATE, client.getInstanceApi().get()
|
||||||
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, ebsInstance.getId()));
|
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
System.out.println("OK: setInstanceInitiatedShutdownBehaviorForInstanceInRegion");
|
System.out.println("OK: setInstanceInitiatedShutdownBehaviorForInstanceInRegion");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -522,7 +522,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
assert runningTester.apply(instance);
|
assert runningTester.apply(instance);
|
||||||
|
|
||||||
// search my identity for the instance I just created
|
// search my identity for the instance I just created
|
||||||
Set<? extends Reservation<? extends RunningInstance>> reservations = client.getInstanceServices()
|
Set<? extends Reservation<? extends RunningInstance>> reservations = client.getInstanceApi().get()
|
||||||
.describeInstancesInRegion(instance.getRegion(), instance.getId()); // last
|
.describeInstancesInRegion(instance.getRegion(), instance.getId()); // last
|
||||||
// parameter
|
// parameter
|
||||||
// (ids)
|
// (ids)
|
||||||
|
@ -544,7 +544,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
if (ebsInstance != null) {
|
if (ebsInstance != null) {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().terminateInstancesInRegion(ebsInstance.getRegion(), ebsInstance.getId());
|
client.getInstanceApi().get().terminateInstancesInRegion(ebsInstance.getRegion(), ebsInstance.getId());
|
||||||
terminatedTester.apply(ebsInstance);
|
terminatedTester.apply(ebsInstance);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -552,7 +552,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
}
|
}
|
||||||
if (ebsImage != null) {
|
if (ebsImage != null) {
|
||||||
try {
|
try {
|
||||||
client.getAMIServices().deregisterImageInRegion(ebsImage.getRegion(), ebsImage.getId());
|
client.getAMIApi().get().deregisterImageInRegion(ebsImage.getRegion(), ebsImage.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -560,14 +560,14 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
|
|
||||||
if (snapshot != null) {
|
if (snapshot != null) {
|
||||||
try {
|
try {
|
||||||
client.getElasticBlockStoreServices().deleteSnapshotInRegion(snapshot.getRegion(), snapshot.getId());
|
client.getElasticBlockStoreApi().get().deleteSnapshotInRegion(snapshot.getRegion(), snapshot.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (attachment != null) {
|
if (attachment != null) {
|
||||||
try {
|
try {
|
||||||
client.getElasticBlockStoreServices().detachVolumeInRegion(volume.getRegion(), volume.getId(), true);
|
client.getElasticBlockStoreApi().get().detachVolumeInRegion(volume.getRegion(), volume.getId(), true);
|
||||||
assert volumeTester.apply(volume);
|
assert volumeTester.apply(volume);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -575,7 +575,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
}
|
}
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().terminateInstancesInRegion(instance.getRegion(), instance.getId());
|
client.getInstanceApi().get().terminateInstancesInRegion(instance.getRegion(), instance.getId());
|
||||||
terminatedTester.apply(instance);
|
terminatedTester.apply(instance);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -583,21 +583,21 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
}
|
}
|
||||||
if (volume != null) {
|
if (volume != null) {
|
||||||
try {
|
try {
|
||||||
client.getElasticBlockStoreServices().deleteVolumeInRegion(volume.getRegion(), volume.getId());
|
client.getElasticBlockStoreApi().get().deleteVolumeInRegion(volume.getRegion(), volume.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keyPair != null) {
|
if (keyPair != null) {
|
||||||
try {
|
try {
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(keyPair.getRegion(), keyPair.getKeyName());
|
client.getKeyPairApi().get().deleteKeyPairInRegion(keyPair.getRegion(), keyPair.getKeyName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (securityGroupName != null) {
|
if (securityGroupName != null) {
|
||||||
try {
|
try {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.ec2;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
import org.jclouds.ec2.services.BaseEC2AsyncClientTest;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code EC2AsyncClient}
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
|
||||||
@Test(groups = "unit", testName = "EC2AsyncClientTest")
|
|
||||||
public class EC2AsyncClientTest extends BaseEC2AsyncClientTest<EC2AsyncClient> {
|
|
||||||
|
|
||||||
private EC2AsyncClient asyncClient;
|
|
||||||
private EC2Client syncClient;
|
|
||||||
|
|
||||||
public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
|
|
||||||
assert syncClient.getAMIServices() != null;
|
|
||||||
assert syncClient.getAvailabilityZoneAndRegionServices() != null;
|
|
||||||
assert syncClient.getElasticBlockStoreServices() != null;
|
|
||||||
assert syncClient.getElasticIPAddressServices() != null;
|
|
||||||
assert syncClient.getInstanceServices() != null;
|
|
||||||
assert syncClient.getKeyPairServices() != null;
|
|
||||||
assert syncClient.getSecurityGroupServices() != null;
|
|
||||||
assert syncClient.getWindowsServices() != null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAsync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
|
|
||||||
assert asyncClient.getAMIServices() != null;
|
|
||||||
assert asyncClient.getAvailabilityZoneAndRegionServices() != null;
|
|
||||||
assert asyncClient.getElasticBlockStoreServices() != null;
|
|
||||||
assert asyncClient.getElasticIPAddressServices() != null;
|
|
||||||
assert asyncClient.getInstanceServices() != null;
|
|
||||||
assert asyncClient.getKeyPairServices() != null;
|
|
||||||
assert asyncClient.getSecurityGroupServices() != null;
|
|
||||||
assert asyncClient.getWindowsServices() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
@Override
|
|
||||||
protected void setupFactory() throws IOException {
|
|
||||||
super.setupFactory();
|
|
||||||
asyncClient = injector.getInstance(EC2AsyncClient.class);
|
|
||||||
syncClient = injector.getInstance(EC2Client.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void checkFilters(HttpRequest request) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,8 +20,8 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.ec2.services.BaseEC2AsyncClientTest;
|
import org.jclouds.ec2.features.BaseEC2ApiTest;
|
||||||
import org.jclouds.ec2.services.InstanceAsyncClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -33,7 +33,7 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "BindS3UploadPolicyAndSignatureTest")
|
@Test(groups = "unit", testName = "BindS3UploadPolicyAndSignatureTest")
|
||||||
public class BindS3UploadPolicyAndSignatureTest extends BaseEC2AsyncClientTest<InstanceAsyncClient> {
|
public class BindS3UploadPolicyAndSignatureTest extends BaseEC2ApiTest<InstanceApi> {
|
||||||
private BindS3UploadPolicyAndSignature binder;
|
private BindS3UploadPolicyAndSignature binder;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
import org.jclouds.ec2.domain.KeyPair;
|
import org.jclouds.ec2.domain.KeyPair;
|
||||||
|
@ -46,10 +46,10 @@ import org.jclouds.ec2.domain.SecurityGroup;
|
||||||
import org.jclouds.ec2.domain.Snapshot;
|
import org.jclouds.ec2.domain.Snapshot;
|
||||||
import org.jclouds.ec2.domain.Volume;
|
import org.jclouds.ec2.domain.Volume;
|
||||||
import org.jclouds.ec2.reference.EC2Constants;
|
import org.jclouds.ec2.reference.EC2Constants;
|
||||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
import org.jclouds.ec2.features.ElasticBlockStoreApi;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
import org.jclouds.ec2.services.KeyPairClient;
|
import org.jclouds.ec2.features.KeyPairApi;
|
||||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
import org.jclouds.ec2.features.SecurityGroupApi;
|
||||||
import org.jclouds.net.domain.IpProtocol;
|
import org.jclouds.net.domain.IpProtocol;
|
||||||
import org.jclouds.scriptbuilder.domain.Statements;
|
import org.jclouds.scriptbuilder.domain.Statements;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
|
@ -85,7 +85,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
|
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
|
||||||
if (view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getTagApi().isPresent()) {
|
if (view.unwrapApi(EC2Api.class).getTagApi().isPresent()) {
|
||||||
super.checkUserMetadataContains(node, userMetadata);
|
super.checkUserMetadataContains(node, userMetadata);
|
||||||
} else {
|
} else {
|
||||||
assertTrue(node.getUserMetadata().isEmpty(), "not expecting metadata when tag extension isn't present" + node);
|
assertTrue(node.getUserMetadata().isEmpty(), "not expecting metadata when tag extension isn't present" + node);
|
||||||
|
@ -103,14 +103,14 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testCompareSizes")
|
@Test(enabled = true, dependsOnMethods = "testCompareSizes")
|
||||||
public void testExtendedOptionsAndLogin() throws Exception {
|
public void testExtendedOptionsAndLogin() throws Exception {
|
||||||
SecurityGroupClient securityGroupClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
SecurityGroupApi securityGroupClient = view.unwrapApi(EC2Api.class)
|
||||||
.getSecurityGroupServices();
|
.getSecurityGroupApi().get();
|
||||||
|
|
||||||
KeyPairClient keyPairClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
KeyPairApi keyPairClient = view.unwrapApi(EC2Api.class)
|
||||||
.getKeyPairServices();
|
.getKeyPairApi().get();
|
||||||
|
|
||||||
InstanceClient instanceClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
InstanceApi instanceClient = view.unwrapApi(EC2Api.class)
|
||||||
.getInstanceServices();
|
.getInstanceApi().get();
|
||||||
|
|
||||||
String group = this.group + "o";
|
String group = this.group + "o";
|
||||||
|
|
||||||
|
@ -203,9 +203,9 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
assertTrue(socketTester.apply(socket), String.format("failed to open socket %s on node %s", socket, node));
|
assertTrue(socketTester.apply(socket), String.format("failed to open socket %s on node %s", socket, node));
|
||||||
|
|
||||||
// check that there is an elastic ip correlating to it
|
// check that there is an elastic ip correlating to it
|
||||||
EC2Client ec2 = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi());
|
EC2Api ec2 = context.unwrapApi(EC2Api.class);
|
||||||
Set<PublicIpInstanceIdPair> ipidpairs =
|
Set<PublicIpInstanceIdPair> ipidpairs =
|
||||||
ec2.getElasticIPAddressServices().describeAddressesInRegion(region, publicIps.toArray(new String[0]));
|
ec2.getElasticIPAddressApi().get().describeAddressesInRegion(region, publicIps.toArray(new String[0]));
|
||||||
assertEquals(ipidpairs.size(), 1, String.format("there should only be one address pair (%s)",
|
assertEquals(ipidpairs.size(), 1, String.format("there should only be one address pair (%s)",
|
||||||
Iterables.toString(ipidpairs)));
|
Iterables.toString(ipidpairs)));
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
// check that the ip is deallocated
|
// check that the ip is deallocated
|
||||||
Set<PublicIpInstanceIdPair> ipidcheck =
|
Set<PublicIpInstanceIdPair> ipidcheck =
|
||||||
ec2.getElasticIPAddressServices().describeAddressesInRegion(region, ipidpair.getPublicIp());
|
ec2.getElasticIPAddressApi().get().describeAddressesInRegion(region, ipidpair.getPublicIp());
|
||||||
assertTrue(Iterables.isEmpty(ipidcheck), String.format("there should be no address pairs (%s)",
|
assertTrue(Iterables.isEmpty(ipidcheck), String.format("there should be no address pairs (%s)",
|
||||||
Iterables.toString(ipidcheck)));
|
Iterables.toString(ipidcheck)));
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -246,11 +246,11 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
throw new SkipException("Test cannot run without the parameter test." + provider
|
throw new SkipException("Test cannot run without the parameter test." + provider
|
||||||
+ ".ebs-template; this property should be in the format defined in TemplateBuilderSpec");
|
+ ".ebs-template; this property should be in the format defined in TemplateBuilderSpec");
|
||||||
}
|
}
|
||||||
InstanceClient instanceClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
InstanceApi instanceClient = view.unwrapApi(EC2Api.class)
|
||||||
.getInstanceServices();
|
.getInstanceApi().get();
|
||||||
|
|
||||||
ElasticBlockStoreClient ebsClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
ElasticBlockStoreApi ebsClient = view.unwrapApi(EC2Api.class)
|
||||||
.getElasticBlockStoreServices();
|
.getElasticBlockStoreApi().get();
|
||||||
|
|
||||||
String group = this.group + "e";
|
String group = this.group + "e";
|
||||||
int volumeSize = 8;
|
int volumeSize = 8;
|
||||||
|
@ -317,14 +317,14 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
*
|
*
|
||||||
* @throws NoSuchElementException If no instance with that id exists, or the instance is in a different region
|
* @throws NoSuchElementException If no instance with that id exists, or the instance is in a different region
|
||||||
*/
|
*/
|
||||||
public static RunningInstance getInstance(InstanceClient instanceClient, String id) {
|
public static RunningInstance getInstance(InstanceApi instanceClient, String id) {
|
||||||
RunningInstance instance = Iterables.getOnlyElement(Iterables.getOnlyElement(instanceClient
|
RunningInstance instance = Iterables.getOnlyElement(Iterables.getOnlyElement(instanceClient
|
||||||
.describeInstancesInRegion(null, id)));
|
.describeInstancesInRegion(null, id)));
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void cleanupExtendedStuffInRegion(String region, SecurityGroupClient securityGroupClient,
|
protected static void cleanupExtendedStuffInRegion(String region, SecurityGroupApi securityGroupClient,
|
||||||
KeyPairClient keyPairClient, String group) throws InterruptedException {
|
KeyPairApi keyPairClient, String group) throws InterruptedException {
|
||||||
try {
|
try {
|
||||||
for (SecurityGroup secgroup : securityGroupClient.describeSecurityGroupsInRegion(region))
|
for (SecurityGroup secgroup : securityGroupClient.describeSecurityGroupsInRegion(region))
|
||||||
if (secgroup.getName().startsWith("jclouds#" + group) || secgroup.getName().equals(group)) {
|
if (secgroup.getName().startsWith("jclouds#" + group) || secgroup.getName().equals(group)) {
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
|
||||||
import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
|
import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
|
||||||
import org.jclouds.ec2.options.DescribeImagesOptions;
|
import org.jclouds.ec2.options.DescribeImagesOptions;
|
||||||
import org.jclouds.ec2.options.DescribeRegionsOptions;
|
import org.jclouds.ec2.options.DescribeRegionsOptions;
|
||||||
import org.jclouds.ec2.services.AMIAsyncClient;
|
import org.jclouds.ec2.features.AMIApi;
|
||||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
|
import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
|
||||||
import org.jclouds.http.HttpCommand;
|
import org.jclouds.http.HttpCommand;
|
||||||
import org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService;
|
import org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
|
@ -67,8 +67,8 @@ public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLive
|
||||||
|
|
||||||
Collection<HttpCommand> filteredCommandsInvoked = Collections2.filter(commandsInvoked, new Predicate<HttpCommand>() {
|
Collection<HttpCommand> filteredCommandsInvoked = Collections2.filter(commandsInvoked, new Predicate<HttpCommand>() {
|
||||||
private final Collection<Method> ignored = ImmutableSet.of(
|
private final Collection<Method> ignored = ImmutableSet.of(
|
||||||
AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions", DescribeRegionsOptions[].class),
|
AvailabilityZoneAndRegionApi.class.getMethod("describeRegions", DescribeRegionsOptions[].class),
|
||||||
AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion", String.class, DescribeAvailabilityZonesOptions[].class));
|
AvailabilityZoneAndRegionApi.class.getMethod("describeAvailabilityZonesInRegion", String.class, DescribeAvailabilityZonesOptions[].class));
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(HttpCommand input) {
|
public boolean apply(HttpCommand input) {
|
||||||
return !ignored.contains(getInvokerOfRequest(input));
|
return !ignored.contains(getInvokerOfRequest(input));
|
||||||
|
@ -76,7 +76,7 @@ public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLive
|
||||||
});
|
});
|
||||||
|
|
||||||
assert filteredCommandsInvoked.size() == 1 : commandsInvoked;
|
assert filteredCommandsInvoked.size() == 1 : commandsInvoked;
|
||||||
assertEquals(getInvokerOfRequestAtIndex(filteredCommandsInvoked, 0), AMIAsyncClient.class
|
assertEquals(getInvokerOfRequestAtIndex(filteredCommandsInvoked, 0), AMIApi.class
|
||||||
.getMethod("describeImagesInRegion", String.class, DescribeImagesOptions[].class));
|
.getMethod("describeImagesInRegion", String.class, DescribeImagesOptions[].class));
|
||||||
assertDescribeImagesOptionsEquals((DescribeImagesOptions[])getArgsForRequestAtIndex(filteredCommandsInvoked, 0).get(1),
|
assertDescribeImagesOptionsEquals((DescribeImagesOptions[])getArgsForRequestAtIndex(filteredCommandsInvoked, 0).get(1),
|
||||||
defaultImageProviderId);
|
defaultImageProviderId);
|
||||||
|
|
|
@ -25,11 +25,12 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.KeyPair;
|
import org.jclouds.ec2.domain.KeyPair;
|
||||||
import org.jclouds.ec2.services.KeyPairClient;
|
import org.jclouds.ec2.features.KeyPairApi;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
|
@ -45,11 +46,11 @@ public class CreateUniqueKeyPairTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testApply() throws UnknownHostException {
|
public void testApply() throws UnknownHostException {
|
||||||
final EC2Client client = createMock(EC2Client.class);
|
final EC2Api client = createMock(EC2Api.class);
|
||||||
KeyPairClient keyClient = createMock(KeyPairClient.class);
|
KeyPairApi keyClient = createMock(KeyPairApi.class);
|
||||||
KeyPair pair = createMock(KeyPair.class);
|
KeyPair pair = createMock(KeyPair.class);
|
||||||
|
|
||||||
expect(client.getKeyPairServices()).andReturn(keyClient).atLeastOnce();
|
expect(client.getKeyPairApi()).andReturn((Optional) Optional.of(keyClient)).atLeastOnce();
|
||||||
|
|
||||||
expect(keyClient.createKeyPairInRegion("region", "jclouds#group#1")).andReturn(pair);
|
expect(keyClient.createKeyPairInRegion("region", "jclouds#group#1")).andReturn(pair);
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ public class CreateUniqueKeyPairTest {
|
||||||
Names.bindProperties(binder(),new EC2ApiMetadata().getDefaultProperties());
|
Names.bindProperties(binder(),new EC2ApiMetadata().getDefaultProperties());
|
||||||
bind(new TypeLiteral<Supplier<String>>() {
|
bind(new TypeLiteral<Supplier<String>>() {
|
||||||
}).toInstance(Suppliers.ofInstance("1"));
|
}).toInstance(Suppliers.ofInstance("1"));
|
||||||
bind(EC2Client.class).toInstance(client);
|
bind(EC2Api.class).toInstance(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).getInstance(CreateUniqueKeyPair.class);
|
}).getInstance(CreateUniqueKeyPair.class);
|
||||||
|
@ -77,13 +78,13 @@ public class CreateUniqueKeyPairTest {
|
||||||
@SuppressWarnings( { "unchecked" })
|
@SuppressWarnings( { "unchecked" })
|
||||||
@Test
|
@Test
|
||||||
public void testApplyWithIllegalStateException() throws UnknownHostException {
|
public void testApplyWithIllegalStateException() throws UnknownHostException {
|
||||||
final EC2Client client = createMock(EC2Client.class);
|
final EC2Api client = createMock(EC2Api.class);
|
||||||
KeyPairClient keyClient = createMock(KeyPairClient.class);
|
KeyPairApi keyClient = createMock(KeyPairApi.class);
|
||||||
final Supplier<String> uniqueIdSupplier = createMock(Supplier.class);
|
final Supplier<String> uniqueIdSupplier = createMock(Supplier.class);
|
||||||
|
|
||||||
KeyPair pair = createMock(KeyPair.class);
|
KeyPair pair = createMock(KeyPair.class);
|
||||||
|
|
||||||
expect(client.getKeyPairServices()).andReturn(keyClient).atLeastOnce();
|
expect(client.getKeyPairApi()).andReturn((Optional) Optional.of(keyClient)).atLeastOnce();
|
||||||
|
|
||||||
expect(uniqueIdSupplier.get()).andReturn("1");
|
expect(uniqueIdSupplier.get()).andReturn("1");
|
||||||
expect(keyClient.createKeyPairInRegion("region", "jclouds#group#1")).andThrow(new IllegalStateException());
|
expect(keyClient.createKeyPairInRegion("region", "jclouds#group#1")).andThrow(new IllegalStateException());
|
||||||
|
@ -101,7 +102,7 @@ public class CreateUniqueKeyPairTest {
|
||||||
Names.bindProperties(binder(),new EC2ApiMetadata().getDefaultProperties());
|
Names.bindProperties(binder(),new EC2ApiMetadata().getDefaultProperties());
|
||||||
bind(new TypeLiteral<Supplier<String>>() {
|
bind(new TypeLiteral<Supplier<String>>() {
|
||||||
}).toInstance(uniqueIdSupplier);
|
}).toInstance(uniqueIdSupplier);
|
||||||
bind(EC2Client.class).toInstance(client);
|
bind(EC2Api.class).toInstance(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).getInstance(CreateUniqueKeyPair.class);
|
}).getInstance(CreateUniqueKeyPair.class);
|
||||||
|
|
|
@ -24,13 +24,14 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,10 +46,10 @@ public class PresentInstancesTest {
|
||||||
@Test
|
@Test
|
||||||
public void testWhenInstancesPresentSingleCall() {
|
public void testWhenInstancesPresentSingleCall() {
|
||||||
|
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
|
|
||||||
expect(client.getInstanceServices()).andReturn(instanceClient);
|
expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient));
|
||||||
|
|
||||||
// avoid imatcher fail. if you change this, be sure to check multiple jres
|
// avoid imatcher fail. if you change this, be sure to check multiple jres
|
||||||
expect(instanceClient.describeInstancesInRegion("us-east-1", "i-aaaa", "i-bbbb")).andReturn(
|
expect(instanceClient.describeInstancesInRegion("us-east-1", "i-aaaa", "i-bbbb")).andReturn(
|
||||||
|
|
|
@ -19,14 +19,14 @@ package org.jclouds.ec2.compute.internal;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.ec2.internal.BaseEC2ClientExpectTest;
|
import org.jclouds.ec2.internal.BaseEC2ApiExpectTest;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
public abstract class BaseEC2ComputeServiceContextExpectTest<T> extends BaseEC2ClientExpectTest<T> implements
|
public abstract class BaseEC2ComputeServiceContextExpectTest<T> extends BaseEC2ApiExpectTest<T> implements
|
||||||
Function<ComputeServiceContext, T> {
|
Function<ComputeServiceContext, T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
|
||||||
import org.jclouds.ec2.domain.SecurityGroup;
|
import org.jclouds.ec2.domain.SecurityGroup;
|
||||||
import org.jclouds.ec2.domain.UserIdGroupPair;
|
import org.jclouds.ec2.domain.UserIdGroupPair;
|
||||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
import org.jclouds.ec2.features.SecurityGroupApi;
|
||||||
import org.jclouds.net.domain.IpProtocol;
|
import org.jclouds.net.domain.IpProtocol;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class CreateSecurityGroupIfNeededTest {
|
||||||
@Test
|
@Test
|
||||||
public void testWhenPort22AndToItselfAuthorizesIngressTwice() throws ExecutionException {
|
public void testWhenPort22AndToItselfAuthorizesIngressTwice() throws ExecutionException {
|
||||||
|
|
||||||
SecurityGroupClient client = createMock(SecurityGroupClient.class);
|
SecurityGroupApi client = createMock(SecurityGroupApi.class);
|
||||||
Predicate<RegionAndName> tester = Predicates.alwaysTrue();
|
Predicate<RegionAndName> tester = Predicates.alwaysTrue();
|
||||||
|
|
||||||
SecurityGroup group = createNiceMock(SecurityGroup.class);
|
SecurityGroup group = createNiceMock(SecurityGroup.class);
|
||||||
|
@ -76,7 +76,7 @@ public class CreateSecurityGroupIfNeededTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIllegalStateExceptionCreatingGroupJustReturns() throws ExecutionException {
|
public void testIllegalStateExceptionCreatingGroupJustReturns() throws ExecutionException {
|
||||||
|
|
||||||
SecurityGroupClient client = createMock(SecurityGroupClient.class);
|
SecurityGroupApi client = createMock(SecurityGroupApi.class);
|
||||||
Predicate<RegionAndName> tester = Predicates.alwaysTrue();
|
Predicate<RegionAndName> tester = Predicates.alwaysTrue();
|
||||||
|
|
||||||
client.createSecurityGroupInRegion("region", "group", "group");
|
client.createSecurityGroupInRegion("region", "group", "group");
|
||||||
|
@ -95,7 +95,7 @@ public class CreateSecurityGroupIfNeededTest {
|
||||||
@Test(expectedExceptions = RuntimeException.class)
|
@Test(expectedExceptions = RuntimeException.class)
|
||||||
public void testWhenEventualConsistencyExpiresIllegalStateException() throws ExecutionException {
|
public void testWhenEventualConsistencyExpiresIllegalStateException() throws ExecutionException {
|
||||||
|
|
||||||
SecurityGroupClient client = createMock(SecurityGroupClient.class);
|
SecurityGroupApi client = createMock(SecurityGroupApi.class);
|
||||||
Predicate<RegionAndName> tester = Predicates.alwaysFalse();
|
Predicate<RegionAndName> tester = Predicates.alwaysFalse();
|
||||||
|
|
||||||
client.createSecurityGroupInRegion("region", "group", "group");
|
client.createSecurityGroupInRegion("region", "group", "group");
|
||||||
|
|
|
@ -22,12 +22,13 @@ import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressClient;
|
import org.jclouds.ec2.features.ElasticIPAddressApi;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,10 +39,10 @@ public class LoadPublicIpForInstanceOrNullTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReturnsPublicIpOnMatch() throws Exception {
|
public void testReturnsPublicIpOnMatch() throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
|
|
||||||
expect(client.getElasticIPAddressServices()).andReturn(ipClient).atLeastOnce();
|
expect(client.getElasticIPAddressApi()).andReturn((Optional) Optional.of(ipClient)).atLeastOnce();
|
||||||
expect(ipClient.describeAddressesInRegion("region")).andReturn(
|
expect(ipClient.describeAddressesInRegion("region")).andReturn(
|
||||||
ImmutableSet.<PublicIpInstanceIdPair> of(new PublicIpInstanceIdPair("region", "1.1.1.1", "i-blah")))
|
ImmutableSet.<PublicIpInstanceIdPair> of(new PublicIpInstanceIdPair("region", "1.1.1.1", "i-blah")))
|
||||||
.atLeastOnce();
|
.atLeastOnce();
|
||||||
|
@ -59,10 +60,10 @@ public class LoadPublicIpForInstanceOrNullTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReturnsNullWhenNotFound() throws Exception {
|
public void testReturnsNullWhenNotFound() throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
|
|
||||||
expect(client.getElasticIPAddressServices()).andReturn(ipClient).atLeastOnce();
|
expect(client.getElasticIPAddressApi()).andReturn((Optional) Optional.of(ipClient)).atLeastOnce();
|
||||||
|
|
||||||
expect(ipClient.describeAddressesInRegion("region")).andReturn(ImmutableSet.<PublicIpInstanceIdPair> of())
|
expect(ipClient.describeAddressesInRegion("region")).andReturn(ImmutableSet.<PublicIpInstanceIdPair> of())
|
||||||
.atLeastOnce();
|
.atLeastOnce();
|
||||||
|
@ -81,10 +82,10 @@ public class LoadPublicIpForInstanceOrNullTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReturnsNullWhenNotAssigned() throws Exception {
|
public void testReturnsNullWhenNotAssigned() throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
|
|
||||||
expect(client.getElasticIPAddressServices()).andReturn(ipClient).atLeastOnce();
|
expect(client.getElasticIPAddressApi()).andReturn((Optional) Optional.of(ipClient)).atLeastOnce();
|
||||||
|
|
||||||
expect(ipClient.describeAddressesInRegion("region")).andReturn(
|
expect(ipClient.describeAddressesInRegion("region")).andReturn(
|
||||||
ImmutableSet.<PublicIpInstanceIdPair> of(new PublicIpInstanceIdPair("region", "1.1.1.1", null)))
|
ImmutableSet.<PublicIpInstanceIdPair> of(new PublicIpInstanceIdPair("region", "1.1.1.1", null)))
|
||||||
|
|
|
@ -29,13 +29,14 @@ import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.functions.EC2ImageParser;
|
import org.jclouds.ec2.compute.functions.EC2ImageParser;
|
||||||
import org.jclouds.ec2.services.AMIClient;
|
import org.jclouds.ec2.features.AMIApi;
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,14 +50,14 @@ public class RegionAndIdToImageTest {
|
||||||
public void testApply() throws ExecutionException {
|
public void testApply() throws ExecutionException {
|
||||||
|
|
||||||
EC2ImageParser parser = createMock(EC2ImageParser.class);
|
EC2ImageParser parser = createMock(EC2ImageParser.class);
|
||||||
EC2Client caller = createMock(EC2Client.class);
|
EC2Api caller = createMock(EC2Api.class);
|
||||||
AMIClient client = createMock(AMIClient.class);
|
AMIApi client = createMock(AMIApi.class);
|
||||||
|
|
||||||
org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
|
org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
|
||||||
Image image = createNiceMock(Image.class);
|
Image image = createNiceMock(Image.class);
|
||||||
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
|
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
|
||||||
|
|
||||||
expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
|
expect(caller.getAMIApi()).andReturn((Optional) Optional.of(client)).atLeastOnce();
|
||||||
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
|
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
|
||||||
expect(parser.apply(ec2Image)).andReturn(image);
|
expect(parser.apply(ec2Image)).andReturn(image);
|
||||||
|
|
||||||
|
@ -81,14 +82,14 @@ public class RegionAndIdToImageTest {
|
||||||
public void testApplyNotFoundMakesExecutionException() throws ExecutionException {
|
public void testApplyNotFoundMakesExecutionException() throws ExecutionException {
|
||||||
|
|
||||||
EC2ImageParser parser = createMock(EC2ImageParser.class);
|
EC2ImageParser parser = createMock(EC2ImageParser.class);
|
||||||
EC2Client caller = createMock(EC2Client.class);
|
EC2Api caller = createMock(EC2Api.class);
|
||||||
AMIClient client = createMock(AMIClient.class);
|
AMIApi client = createMock(AMIApi.class);
|
||||||
|
|
||||||
org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
|
org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
|
||||||
Image image = createNiceMock(Image.class);
|
Image image = createNiceMock(Image.class);
|
||||||
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
|
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
|
||||||
|
|
||||||
expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
|
expect(caller.getAMIApi()).andReturn((Optional) Optional.of(client)).atLeastOnce();
|
||||||
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
|
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
|
||||||
expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException());
|
expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException());
|
||||||
|
|
||||||
|
@ -113,14 +114,14 @@ public class RegionAndIdToImageTest {
|
||||||
public void testApplyNoSuchElementExceptionMakesExecutionException() throws ExecutionException {
|
public void testApplyNoSuchElementExceptionMakesExecutionException() throws ExecutionException {
|
||||||
|
|
||||||
EC2ImageParser parser = createMock(EC2ImageParser.class);
|
EC2ImageParser parser = createMock(EC2ImageParser.class);
|
||||||
EC2Client caller = createMock(EC2Client.class);
|
EC2Api caller = createMock(EC2Api.class);
|
||||||
AMIClient client = createMock(AMIClient.class);
|
AMIApi client = createMock(AMIApi.class);
|
||||||
|
|
||||||
org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
|
org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
|
||||||
Image image = createNiceMock(Image.class);
|
Image image = createNiceMock(Image.class);
|
||||||
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
|
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
|
||||||
|
|
||||||
expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
|
expect(caller.getAMIApi()).andReturn((Optional) Optional.of(client)).atLeastOnce();
|
||||||
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
|
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
|
||||||
expect(parser.apply(ec2Image)).andThrow(new NoSuchElementException());
|
expect(parser.apply(ec2Image)).andThrow(new NoSuchElementException());
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationBuilder;
|
import org.jclouds.domain.LocationBuilder;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.functions.PresentInstances;
|
import org.jclouds.ec2.compute.functions.PresentInstances;
|
||||||
import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
|
import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
|
||||||
|
@ -50,8 +50,8 @@ import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.ec2.options.RunInstancesOptions;
|
import org.jclouds.ec2.options.RunInstancesOptions;
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressClient;
|
import org.jclouds.ec2.features.ElasticIPAddressApi;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
||||||
// setup mocks
|
// setup mocks
|
||||||
EC2CreateNodesInGroupThenAddToSet strategy = setupStrategy(nodeMetadata);
|
EC2CreateNodesInGroupThenAddToSet strategy = setupStrategy(nodeMetadata);
|
||||||
InputParams input = new InputParams(location);
|
InputParams input = new InputParams(location);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
RunInstancesOptions ec2Options = createMock(RunInstancesOptions.class);
|
RunInstancesOptions ec2Options = createMock(RunInstancesOptions.class);
|
||||||
RunningInstance instance = createMock(RunningInstance.class);
|
RunningInstance instance = createMock(RunningInstance.class);
|
||||||
Reservation<? extends RunningInstance> reservation = new Reservation<RunningInstance>(region,
|
Reservation<? extends RunningInstance> reservation = new Reservation<RunningInstance>(region,
|
||||||
|
@ -93,11 +93,11 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
||||||
|
|
||||||
// setup expectations
|
// setup expectations
|
||||||
expect(input.template.clone()).andReturn(input.template);
|
expect(input.template.clone()).andReturn(input.template);
|
||||||
expect(strategy.client.getInstanceServices()).andReturn(instanceClient).atLeastOnce();
|
expect(strategy.client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
|
||||||
expect(
|
expect(
|
||||||
strategy.createKeyPairAndSecurityGroupsAsNeededAndReturncustomize
|
strategy.createKeyPairAndSecurityGroupsAsNeededAndReturncustomize
|
||||||
.execute(region, input.tag, input.template)).andReturn(ec2Options);
|
.execute(region, input.tag, input.template)).andReturn(ec2Options);
|
||||||
expect(strategy.client.getElasticIPAddressServices()).andReturn(ipClient).atLeastOnce();
|
expect(strategy.client.getElasticIPAddressApi()).andReturn((Optional) Optional.of(ipClient)).atLeastOnce();
|
||||||
|
|
||||||
expect(input.template.getLocation()).andReturn(input.location).atLeastOnce();
|
expect(input.template.getLocation()).andReturn(input.location).atLeastOnce();
|
||||||
expect(input.template.getImage()).andReturn(input.image).atLeastOnce();
|
expect(input.template.getImage()).andReturn(input.image).atLeastOnce();
|
||||||
|
@ -191,7 +191,7 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
||||||
// setup mocks
|
// setup mocks
|
||||||
EC2CreateNodesInGroupThenAddToSet strategy = setupStrategy(nodeMetadata);
|
EC2CreateNodesInGroupThenAddToSet strategy = setupStrategy(nodeMetadata);
|
||||||
InputParams input = new InputParams(location);
|
InputParams input = new InputParams(location);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
RunInstancesOptions ec2Options = createMock(RunInstancesOptions.class);
|
RunInstancesOptions ec2Options = createMock(RunInstancesOptions.class);
|
||||||
RunningInstance instance = createMock(RunningInstance.class);
|
RunningInstance instance = createMock(RunningInstance.class);
|
||||||
Reservation<? extends RunningInstance> reservation = new Reservation<RunningInstance>(region,
|
Reservation<? extends RunningInstance> reservation = new Reservation<RunningInstance>(region,
|
||||||
|
@ -200,7 +200,7 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
||||||
|
|
||||||
// setup expectations
|
// setup expectations
|
||||||
expect(input.template.clone()).andReturn(input.template);
|
expect(input.template.clone()).andReturn(input.template);
|
||||||
expect(strategy.client.getInstanceServices()).andReturn(instanceClient).atLeastOnce();
|
expect(strategy.client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
|
||||||
expect(
|
expect(
|
||||||
strategy.createKeyPairAndSecurityGroupsAsNeededAndReturncustomize
|
strategy.createKeyPairAndSecurityGroupsAsNeededAndReturncustomize
|
||||||
.execute(region, input.tag, input.template)).andReturn(ec2Options);
|
.execute(region, input.tag, input.template)).andReturn(ec2Options);
|
||||||
|
@ -307,7 +307,7 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private EC2CreateNodesInGroupThenAddToSet setupStrategy(final NodeMetadata node) {
|
private EC2CreateNodesInGroupThenAddToSet setupStrategy(final NodeMetadata node) {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class);
|
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class);
|
||||||
PresentInstances presentInstances = createMock(PresentInstances.class);
|
PresentInstances presentInstances = createMock(PresentInstances.class);
|
||||||
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class);
|
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class);
|
||||||
|
|
|
@ -26,12 +26,13 @@ import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.services.ElasticIPAddressClient;
|
import org.jclouds.ec2.features.ElasticIPAddressApi;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.features.InstanceApi;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
|
|
||||||
|
@ -44,14 +45,14 @@ public class EC2DestroyNodeStrategyTest {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void testDestroyNodeTerminatesInstanceAndReturnsRefreshedNode() throws Exception {
|
public void testDestroyNodeTerminatesInstanceAndReturnsRefreshedNode() throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
||||||
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
||||||
|
|
||||||
NodeMetadata node = createMock(NodeMetadata.class);
|
NodeMetadata node = createMock(NodeMetadata.class);
|
||||||
|
|
||||||
expect(client.getInstanceServices()).andReturn(instanceClient).atLeastOnce();
|
expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
|
||||||
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
||||||
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
||||||
|
|
||||||
|
@ -74,23 +75,23 @@ public class EC2DestroyNodeStrategyTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDestroyNodeDisassociatesAndReleasesIpThenTerminatesInstanceAndReturnsRefreshedNode()
|
public void testDestroyNodeDisassociatesAndReleasesIpThenTerminatesInstanceAndReturnsRefreshedNode()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
||||||
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
|
|
||||||
NodeMetadata node = createMock(NodeMetadata.class);
|
NodeMetadata node = createMock(NodeMetadata.class);
|
||||||
|
|
||||||
expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andReturn("1.1.1.1");
|
expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andReturn("1.1.1.1");
|
||||||
|
|
||||||
expect(client.getElasticIPAddressServices()).andReturn(ipClient).atLeastOnce();
|
expect(client.getElasticIPAddressApi()).andReturn((Optional) Optional.of(ipClient)).atLeastOnce();
|
||||||
ipClient.disassociateAddressInRegion("region", "1.1.1.1");
|
ipClient.disassociateAddressInRegion("region", "1.1.1.1");
|
||||||
ipClient.releaseAddressInRegion("region", "1.1.1.1");
|
ipClient.releaseAddressInRegion("region", "1.1.1.1");
|
||||||
elasticIpCache.invalidate(new RegionAndName("region", "i-blah"));
|
elasticIpCache.invalidate(new RegionAndName("region", "i-blah"));
|
||||||
|
|
||||||
|
|
||||||
expect(client.getInstanceServices()).andReturn(instanceClient).atLeastOnce();
|
expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
|
||||||
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
||||||
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
||||||
|
|
||||||
|
@ -117,17 +118,17 @@ public class EC2DestroyNodeStrategyTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDestroyNodeSafeOnCacheMissThenTerminatesInstanceAndReturnsRefreshedNode()
|
public void testDestroyNodeSafeOnCacheMissThenTerminatesInstanceAndReturnsRefreshedNode()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
||||||
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
|
|
||||||
NodeMetadata node = createMock(NodeMetadata.class);
|
NodeMetadata node = createMock(NodeMetadata.class);
|
||||||
|
|
||||||
expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andThrow(new CacheLoader.InvalidCacheLoadException(null));
|
expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andThrow(new CacheLoader.InvalidCacheLoadException(null));
|
||||||
|
|
||||||
expect(client.getInstanceServices()).andReturn(instanceClient).atLeastOnce();
|
expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
|
||||||
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
||||||
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
||||||
|
|
||||||
|
@ -154,17 +155,17 @@ public class EC2DestroyNodeStrategyTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDestroyNodeSafeOnCacheExecutionExceptionThenTerminatesInstanceAndReturnsRefreshedNode()
|
public void testDestroyNodeSafeOnCacheExecutionExceptionThenTerminatesInstanceAndReturnsRefreshedNode()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
EC2Client client = createMock(EC2Client.class);
|
EC2Api client = createMock(EC2Api.class);
|
||||||
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
GetNodeMetadataStrategy getNode = createMock(GetNodeMetadataStrategy.class);
|
||||||
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
||||||
ElasticIPAddressClient ipClient = createMock(ElasticIPAddressClient.class);
|
ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
|
||||||
InstanceClient instanceClient = createMock(InstanceClient.class);
|
InstanceApi instanceClient = createMock(InstanceApi.class);
|
||||||
|
|
||||||
NodeMetadata node = createMock(NodeMetadata.class);
|
NodeMetadata node = createMock(NodeMetadata.class);
|
||||||
|
|
||||||
expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andThrow(new ExecutionException(null));
|
expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andThrow(new ExecutionException(null));
|
||||||
|
|
||||||
expect(client.getInstanceServices()).andReturn(instanceClient).atLeastOnce();
|
expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
|
||||||
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
|
||||||
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
expect(getNode.getNode("region/i-blah")).andReturn(node);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.ec2.internal.BaseEC2ClientExpectTest;
|
import org.jclouds.ec2.internal.BaseEC2ApiExpectTest;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
|
@ -46,8 +46,8 @@ import com.google.inject.TypeLiteral;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "EC2RestClientModuleExpectTest")
|
@Test(groups = "unit", testName = "EC2HttpApiModuleExpectTest")
|
||||||
public class EC2RestClientModuleExpectTest extends BaseEC2ClientExpectTest<Injector> {
|
public class EC2HttpApiModuleExpectTest extends BaseEC2ApiExpectTest<Injector> {
|
||||||
private Injector injector;
|
private Injector injector;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.concat;
|
import static com.google.common.collect.Iterables.concat;
|
||||||
|
@ -36,8 +36,8 @@ import org.jclouds.compute.RunNodesException;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.compute.domain.TemplateBuilderSpec;
|
import org.jclouds.compute.domain.TemplateBuilderSpec;
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
import org.jclouds.ec2.domain.Image;
|
import org.jclouds.ec2.domain.Image;
|
||||||
import org.jclouds.ec2.domain.Image.ImageType;
|
import org.jclouds.ec2.domain.Image.ImageType;
|
||||||
|
@ -53,15 +53,15 @@ import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code AMIClient}
|
* Tests behavior of {@code AMIApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true)
|
@Test(groups = "live", singleThreaded = true)
|
||||||
public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class AMIApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
private TemplateBuilderSpec ebsTemplate;
|
private TemplateBuilderSpec ebsTemplate;
|
||||||
|
|
||||||
public AMIClientLiveTest() {
|
public AMIApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
return overrides;
|
return overrides;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EC2Client ec2Client;
|
protected EC2Api ec2Api;
|
||||||
protected AMIClient client;
|
protected AMIApi client;
|
||||||
|
|
||||||
protected Predicate<RunningInstance> runningTester;
|
protected Predicate<RunningInstance> runningTester;
|
||||||
|
|
||||||
|
@ -90,10 +90,10 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
ec2Api = view.unwrapApi(EC2Api.class);
|
||||||
runningTester = retry(new InstanceStateRunning(ec2Client), 600, 5, SECONDS);
|
runningTester = retry(new InstanceStateRunning(ec2Api), 600, 5, SECONDS);
|
||||||
|
|
||||||
client = ec2Client.getAMIServices();
|
client = ec2Api.getAMIApi().get();
|
||||||
if (ebsTemplate != null) {
|
if (ebsTemplate != null) {
|
||||||
Template template = view.getComputeService().templateBuilder().from(ebsTemplate).build();
|
Template template = view.getComputeService().templateBuilder().from(ebsTemplate).build();
|
||||||
regionId = template.getLocation().getId();
|
regionId = template.getLocation().getId();
|
||||||
|
@ -115,7 +115,7 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeImages() {
|
public void testDescribeImages() {
|
||||||
for (String region : ec2Client.getConfiguredRegions()) {
|
for (String region : ec2Api.getConfiguredRegions()) {
|
||||||
Set<? extends Image> allResults = client.describeImagesInRegion(region);
|
Set<? extends Image> allResults = client.describeImagesInRegion(region);
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
assert allResults.size() >= 2 : allResults.size();
|
assert allResults.size() >= 2 : allResults.size();
|
||||||
|
@ -164,23 +164,23 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
|
|
||||||
String instanceId = null;
|
String instanceId = null;
|
||||||
try {
|
try {
|
||||||
RunningInstance instance = getOnlyElement(concat(ec2Client.getInstanceServices().runInstancesInRegion(
|
RunningInstance instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().runInstancesInRegion(
|
||||||
regionId, null, imageId, 1, 1)));
|
regionId, null, imageId, 1, 1)));
|
||||||
instanceId = instance.getId();
|
instanceId = instance.getId();
|
||||||
|
|
||||||
assertTrue(runningTester.apply(instance), instanceId + "didn't achieve the state running!");
|
assertTrue(runningTester.apply(instance), instanceId + "didn't achieve the state running!");
|
||||||
|
|
||||||
instance = getOnlyElement(concat(ec2Client.getInstanceServices().describeInstancesInRegion(regionId,
|
instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().describeInstancesInRegion(regionId,
|
||||||
instanceId)));
|
instanceId)));
|
||||||
BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
|
BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
|
||||||
assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
|
assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
|
||||||
Snapshot snapshot = ec2Client.getElasticBlockStoreServices().createSnapshotInRegion(regionId,
|
Snapshot snapshot = ec2Api.getElasticBlockStoreApi().get().createSnapshotInRegion(regionId,
|
||||||
device.getVolumeId());
|
device.getVolumeId());
|
||||||
snapshotsToDelete.add(snapshot.getId());
|
snapshotsToDelete.add(snapshot.getId());
|
||||||
return snapshot;
|
return snapshot;
|
||||||
} finally {
|
} finally {
|
||||||
if (instanceId != null)
|
if (instanceId != null)
|
||||||
ec2Client.getInstanceServices().terminateInstancesInRegion(regionId, instanceId);
|
ec2Api.getInstanceApi().get().terminateInstancesInRegion(regionId, instanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
for (String imageId : imagesToDeregister)
|
for (String imageId : imagesToDeregister)
|
||||||
client.deregisterImageInRegion(regionId, imageId);
|
client.deregisterImageInRegion(regionId, imageId);
|
||||||
for (String snapshotId : snapshotsToDelete)
|
for (String snapshotId : snapshotsToDelete)
|
||||||
ec2Client.getElasticBlockStoreServices().deleteSnapshotInRegion(regionId, snapshotId);
|
ec2Api.getElasticBlockStoreApi().get().deleteSnapshotInRegion(regionId, snapshotId);
|
||||||
super.tearDownContext();
|
super.tearDownContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.executableBy;
|
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.executableBy;
|
||||||
import static org.jclouds.reflect.Reflection2.method;
|
import static org.jclouds.reflect.Reflection2.method;
|
||||||
|
@ -40,13 +40,13 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code AMIAsyncClient}
|
* Tests behavior of {@code AMIApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "AMIAsyncClientTest")
|
@Test(groups = "unit", testName = "AMIApiTest")
|
||||||
public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
public class AMIApiTest extends BaseEC2ApiTest<AMIApi> {
|
||||||
|
|
||||||
HttpRequest createImage = HttpRequest.builder().method("POST")
|
HttpRequest createImage = HttpRequest.builder().method("POST")
|
||||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
@ -62,7 +62,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "createImageInRegion", String.class, String.class, String.class,
|
||||||
CreateImageOptions[].class);
|
CreateImageOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "createImageInRegion", String.class, String.class, String.class,
|
||||||
CreateImageOptions[].class);
|
CreateImageOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
||||||
.withDescription("description").noReboot()));
|
.withDescription("description").noReboot()));
|
||||||
|
@ -126,7 +126,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "describeImagesInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "describeImagesInRegion", String.class,
|
||||||
DescribeImagesOptions[].class);
|
DescribeImagesOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "describeImagesInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "describeImagesInRegion", String.class,
|
||||||
DescribeImagesOptions[].class);
|
DescribeImagesOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||||
"1", "2")));
|
"1", "2")));
|
||||||
|
@ -193,7 +193,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "deregisterImageInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(AMIApi.class, "deregisterImageInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||||
|
|
||||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||||
|
@ -224,7 +224,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "registerImageFromManifestInRegion", String.class, String.class,
|
||||||
String.class, RegisterImageOptions[].class);
|
String.class, RegisterImageOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "registerImageFromManifestInRegion", String.class, String.class,
|
||||||
String.class, RegisterImageOptions[].class);
|
String.class, RegisterImageOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
||||||
.withDescription("description")));
|
.withDescription("description")));
|
||||||
|
@ -291,7 +291,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class);
|
String.class, String.class, RegisterImageBackedByEbsOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class);
|
String.class, String.class, RegisterImageBackedByEbsOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId",
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId",
|
||||||
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
||||||
|
@ -366,7 +366,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "getBlockDeviceMappingsForImageInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "getBlockDeviceMappingsForImageInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "getLaunchPermissionForImageInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(AMIApi.class, "getLaunchPermissionForImageInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||||
|
|
||||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||||
|
@ -433,7 +433,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "addLaunchPermissionsToImageInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "addLaunchPermissionsToImageInRegion", String.class,
|
||||||
Iterable.class, Iterable.class, String.class);
|
Iterable.class, Iterable.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "imageId"));
|
.of("all"), "imageId"));
|
||||||
|
@ -470,7 +470,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "removeLaunchPermissionsFromImageInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "removeLaunchPermissionsFromImageInRegion", String.class,
|
||||||
Iterable.class, Iterable.class, String.class);
|
Iterable.class, Iterable.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "imageId"));
|
.of("all"), "imageId"));
|
||||||
|
@ -502,7 +502,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "resetLaunchPermissionsOnImageInRegion", String.class,
|
Invokable<?, ?> method = method(AMIApi.class, "resetLaunchPermissionsOnImageInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones;
|
import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones;
|
||||||
import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions;
|
import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions;
|
||||||
|
@ -28,8 +28,8 @@ import java.util.Set;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -37,29 +37,29 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code AvailabilityZoneAndRegionClient}
|
* Tests behavior of {@code AvailabilityZoneAndRegionApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "AvailabilityZoneAndRegionClientLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "AvailabilityZoneAndRegionApiLiveTest")
|
||||||
public class AvailabilityZoneAndRegionClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class AvailabilityZoneAndRegionApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
public AvailabilityZoneAndRegionClientLiveTest() {
|
public AvailabilityZoneAndRegionApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
private EC2Client ec2Client;
|
private EC2Api ec2Api;
|
||||||
private AvailabilityZoneAndRegionClient client;
|
private AvailabilityZoneAndRegionApi client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
ec2Api = view.unwrapApi(EC2Api.class);
|
||||||
client = ec2Client.getAvailabilityZoneAndRegionServices();
|
client = ec2Api.getAvailabilityZoneAndRegionApi().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeAvailabilityZones() {
|
public void testDescribeAvailabilityZones() {
|
||||||
for (String region : ec2Client.getConfiguredRegions()) {
|
for (String region : ec2Api.getConfiguredRegions()) {
|
||||||
Set<AvailabilityZoneInfo> allResults = client.describeAvailabilityZonesInRegion(region);
|
Set<AvailabilityZoneInfo> allResults = client.describeAvailabilityZonesInRegion(region);
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
assert allResults.size() >= 1 : allResults.size();
|
assert allResults.size() >= 1 : allResults.size();
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones;
|
import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones;
|
||||||
import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions;
|
import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions;
|
||||||
|
@ -35,17 +35,17 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code AvailabilityZoneAndRegionAsyncClient}
|
* Tests behavior of {@code AvailabilityZoneAndRegionApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "AvailabilityZoneAndRegionAsyncClientTest")
|
@Test(groups = "unit", testName = "AvailabilityZoneAndRegionApiTest")
|
||||||
public class AvailabilityZoneAndRegionAsyncClientTest extends
|
public class AvailabilityZoneAndRegionApiTest extends
|
||||||
BaseEC2AsyncClientTest<AvailabilityZoneAndRegionAsyncClient> {
|
BaseEC2ApiTest<AvailabilityZoneAndRegionApi> {
|
||||||
|
|
||||||
public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeAvailabilityZonesInRegion",
|
Invokable<?, ?> method = method(AvailabilityZoneAndRegionApi.class, "describeAvailabilityZonesInRegion",
|
||||||
String.class, DescribeAvailabilityZonesOptions[].class);
|
String.class, DescribeAvailabilityZonesOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(Region.US_WEST_1));
|
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(Region.US_WEST_1));
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeAvailabilityZonesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeAvailabilityZonesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeAvailabilityZonesInRegion",
|
Invokable<?, ?> method = method(AvailabilityZoneAndRegionApi.class, "describeAvailabilityZonesInRegion",
|
||||||
String.class, DescribeAvailabilityZonesOptions[].class);
|
String.class, DescribeAvailabilityZonesOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("us-east-1", availabilityZones("us-east-1a", "us-east-1b")));
|
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("us-east-1", availabilityZones("us-east-1a", "us-east-1b")));
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeRegions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeRegions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeRegions",
|
Invokable<?, ?> method = method(AvailabilityZoneAndRegionApi.class, "describeRegions",
|
||||||
DescribeRegionsOptions[].class);
|
DescribeRegionsOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeRegionsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeRegionsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeRegions",
|
Invokable<?, ?> method = method(AvailabilityZoneAndRegionApi.class, "describeRegions",
|
||||||
DescribeRegionsOptions[].class);
|
DescribeRegionsOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(regions(Region.US_EAST_1, Region.US_WEST_1)));
|
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(regions(Region.US_EAST_1, Region.US_WEST_1)));
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static com.google.common.collect.Maps.transformValues;
|
import static com.google.common.collect.Maps.transformValues;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
@ -32,16 +32,15 @@ import org.jclouds.aws.filters.FormSigner;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2AsyncClient;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.config.EC2RestClientModule;
|
import org.jclouds.ec2.config.BaseEC2HttpApiModule;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.location.config.LocationModule;
|
import org.jclouds.location.config.LocationModule;
|
||||||
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
||||||
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresHttpApi;
|
||||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
import org.jclouds.rest.internal.BaseAsyncApiTest;
|
||||||
import org.jclouds.util.Suppliers2;
|
import org.jclouds.util.Suppliers2;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -59,9 +58,13 @@ import com.google.inject.Provides;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit")
|
@Test(groups = "unit")
|
||||||
public abstract class BaseEC2AsyncClientTest<T> extends BaseAsyncClientTest<T> {
|
public abstract class BaseEC2ApiTest<T> extends BaseAsyncApiTest<T> {
|
||||||
@ConfiguresRestClient
|
@ConfiguresHttpApi
|
||||||
protected static class StubEC2RestClientModule extends EC2RestClientModule<EC2Client, EC2AsyncClient> {
|
protected static class StubEC2HttpApiModule extends BaseEC2HttpApiModule<EC2Api> {
|
||||||
|
|
||||||
|
protected StubEC2HttpApiModule() {
|
||||||
|
super(EC2Api.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -132,7 +135,7 @@ public abstract class BaseEC2AsyncClientTest<T> extends BaseAsyncClientTest<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Module createModule() {
|
protected Module createModule() {
|
||||||
return new StubEC2RestClientModule();
|
return new StubEC2HttpApiModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -14,13 +14,13 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.domain.Volume;
|
import org.jclouds.ec2.domain.Volume;
|
||||||
import org.jclouds.ec2.internal.BaseEC2ClientExpectTest;
|
import org.jclouds.ec2.internal.BaseEC2ApiExpectTest;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -31,8 +31,8 @@ import com.google.common.collect.ImmutableMap.Builder;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "EC2ElasticBlockStoreClientExpectTest")
|
@Test(groups = "unit", testName = "EC2ElasticBlockStoreApiExpectTest")
|
||||||
public class EC2ElasticBlockStoreClientExpectTest extends BaseEC2ClientExpectTest<EC2Client> {
|
public class EC2ElasticBlockStoreApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
|
||||||
Volume creating = Volume.builder()
|
Volume creating = Volume.builder()
|
||||||
.id("vol-2a21e543")
|
.id("vol-2a21e543")
|
||||||
.status(Volume.Status.CREATING)
|
.status(Volume.Status.CREATING)
|
||||||
|
@ -57,7 +57,7 @@ public class EC2ElasticBlockStoreClientExpectTest extends BaseEC2ClientExpectTes
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.payload(payloadFromResource("/created_volume.xml")).build());
|
.payload(payloadFromResource("/created_volume.xml")).build());
|
||||||
|
|
||||||
ElasticBlockStoreClient client = requestsSendResponses(builder.build()).getElasticBlockStoreServices();
|
ElasticBlockStoreApi client = requestsSendResponses(builder.build()).getElasticBlockStoreApi().get();
|
||||||
|
|
||||||
assertEquals(client.createVolumeInAvailabilityZone("us-east-1a", 4), creating);
|
assertEquals(client.createVolumeInAvailabilityZone("us-east-1a", 4), creating);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class EC2ElasticBlockStoreClientExpectTest extends BaseEC2ClientExpectTes
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.payload(payloadFromResource("/created_volume.xml")).build());
|
.payload(payloadFromResource("/created_volume.xml")).build());
|
||||||
|
|
||||||
ElasticBlockStoreClient client = requestsSendResponses(builder.build()).getElasticBlockStoreServices();
|
ElasticBlockStoreApi client = requestsSendResponses(builder.build()).getElasticBlockStoreApi().get();
|
||||||
|
|
||||||
assertEquals(client.createVolumeFromSnapshotInAvailabilityZone(region + "a", 1, "snap-8b7ffbdd"), creating.toBuilder().region(region).build());
|
assertEquals(client.createVolumeFromSnapshotInAvailabilityZone(region + "a", 1, "snap-8b7ffbdd"), creating.toBuilder().region(region).build());
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||||
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.snapshotIds;
|
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.snapshotIds;
|
||||||
|
@ -26,8 +26,8 @@ import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
||||||
import org.jclouds.ec2.domain.Snapshot;
|
import org.jclouds.ec2.domain.Snapshot;
|
||||||
import org.jclouds.ec2.domain.Volume;
|
import org.jclouds.ec2.domain.Volume;
|
||||||
|
@ -42,18 +42,18 @@ import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ElasticBlockStoreClient}
|
* Tests behavior of {@code ElasticBlockStoreApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "ElasticBlockStoreClientLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "ElasticBlockStoreApiLiveTest")
|
||||||
public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class ElasticBlockStoreApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
public ElasticBlockStoreClientLiveTest() {
|
public ElasticBlockStoreApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
private EC2Client ec2Client;
|
private EC2Api ec2Api;
|
||||||
private ElasticBlockStoreClient client;
|
private ElasticBlockStoreApi client;
|
||||||
|
|
||||||
private String defaultRegion;
|
private String defaultRegion;
|
||||||
private String defaultZone;
|
private String defaultZone;
|
||||||
|
@ -65,9 +65,9 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
ec2Api = view.unwrapApi(EC2Api.class);
|
||||||
client = ec2Client.getElasticBlockStoreServices();
|
client = ec2Api.getElasticBlockStoreApi().get();
|
||||||
AvailabilityZoneInfo info = Iterables.get(ec2Client.getAvailabilityZoneAndRegionServices()
|
AvailabilityZoneInfo info = Iterables.get(ec2Api.getAvailabilityZoneAndRegionApi().get()
|
||||||
.describeAvailabilityZonesInRegion(defaultRegion), 0);
|
.describeAvailabilityZonesInRegion(defaultRegion), 0);
|
||||||
defaultRegion = checkNotNull(Strings.emptyToNull(info.getRegion()), "region of " + info);
|
defaultRegion = checkNotNull(Strings.emptyToNull(info.getRegion()), "region of " + info);
|
||||||
defaultZone = checkNotNull(Strings.emptyToNull(info.getZone()), "zone of " + info);
|
defaultZone = checkNotNull(Strings.emptyToNull(info.getZone()), "zone of " + info);
|
||||||
|
@ -75,7 +75,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDescribeVolumes() {
|
void testDescribeVolumes() {
|
||||||
for (String region : ec2Client.getConfiguredRegions()) {
|
for (String region : ec2Api.getConfiguredRegions()) {
|
||||||
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
|
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
if (allResults.size() >= 1) {
|
if (allResults.size() >= 1) {
|
||||||
|
@ -163,7 +163,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDescribeSnapshots() {
|
void testDescribeSnapshots() {
|
||||||
for (String region : ec2Client.getConfiguredRegions()) {
|
for (String region : ec2Api.getConfiguredRegions()) {
|
||||||
SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
|
SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
if (allResults.size() >= 1) {
|
if (allResults.size() >= 1) {
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.ownedBy;
|
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.ownedBy;
|
||||||
import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromInstance;
|
import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromInstance;
|
||||||
|
@ -42,16 +42,16 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ElasticBlockStoreAsyncClient}
|
* Tests behavior of {@code ElasticBlockStoreApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "ElasticBlockStoreAsyncClientTest")
|
@Test(groups = "unit", testName = "ElasticBlockStoreApiTest")
|
||||||
public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<ElasticBlockStoreAsyncClient> {
|
public class ElasticBlockStoreApiTest extends BaseEC2ApiTest<ElasticBlockStoreApi> {
|
||||||
|
|
||||||
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "deleteVolumeInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "deleteVolumeInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -78,7 +78,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeVolumesInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "describeVolumesInRegion", String.class,
|
||||||
String[].class);
|
String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeVolumesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeVolumesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeVolumesInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "describeVolumesInRegion", String.class,
|
||||||
String[].class);
|
String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "attachVolumeInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "attachVolumeInRegion", String.class, String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", "instanceId", "/device"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", "instanceId", "/device"));
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "detachVolumeInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "detachVolumeInRegion", String.class, String.class,
|
||||||
boolean.class, DetachVolumeOptions[].class);
|
boolean.class, DetachVolumeOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", false));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", false));
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "detachVolumeInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "detachVolumeInRegion", String.class, String.class,
|
||||||
boolean.class, DetachVolumeOptions[].class);
|
boolean.class, DetachVolumeOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", true, fromInstance("instanceId").fromDevice(
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", true, fromInstance("instanceId").fromDevice(
|
||||||
"/device")));
|
"/device")));
|
||||||
|
@ -214,7 +214,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "createSnapshotInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "createSnapshotInRegion", String.class,
|
||||||
String.class, CreateSnapshotOptions[].class);
|
String.class, CreateSnapshotOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId"));
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateSnapshotOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateSnapshotOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "createSnapshotInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "createSnapshotInRegion", String.class,
|
||||||
String.class, CreateSnapshotOptions[].class);
|
String.class, CreateSnapshotOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId", CreateSnapshotOptions.Builder
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId", CreateSnapshotOptions.Builder
|
||||||
.withDescription("description")));
|
.withDescription("description")));
|
||||||
|
@ -250,7 +250,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeSnapshots() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeSnapshots() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeSnapshotsInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "describeSnapshotsInRegion", String.class,
|
||||||
DescribeSnapshotsOptions[].class);
|
DescribeSnapshotsOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeSnapshotsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeSnapshotsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeSnapshotsInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "describeSnapshotsInRegion", String.class,
|
||||||
DescribeSnapshotsOptions[].class);
|
DescribeSnapshotsOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ownedBy("o1", "o2").restorableBy("r1", "r2")
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ownedBy("o1", "o2").restorableBy("r1", "r2")
|
||||||
.snapshotIds("s1", "s2")));
|
.snapshotIds("s1", "s2")));
|
||||||
|
@ -287,7 +287,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetCreateVolumePermissionForSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetCreateVolumePermissionForSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "getCreateVolumePermissionForSnapshotInRegion",
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "getCreateVolumePermissionForSnapshotInRegion",
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "addCreateVolumePermissionsToSnapshotInRegion",
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "addCreateVolumePermissionsToSnapshotInRegion",
|
||||||
String.class, Iterable.class, Iterable.class, String.class);
|
String.class, Iterable.class, Iterable.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "snapshotId"));
|
.of("all"), "snapshotId"));
|
||||||
|
@ -361,7 +361,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
|
|
||||||
public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, NoSuchMethodException,
|
public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "removeCreateVolumePermissionsFromSnapshotInRegion",
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "removeCreateVolumePermissionsFromSnapshotInRegion",
|
||||||
String.class, Iterable.class, Iterable.class, String.class);
|
String.class, Iterable.class, Iterable.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "snapshotId"));
|
.of("all"), "snapshotId"));
|
||||||
|
@ -382,7 +382,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
|
|
||||||
public void testResetCreateVolumePermissionsOnSnapshot() throws SecurityException, NoSuchMethodException,
|
public void testResetCreateVolumePermissionsOnSnapshot() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "resetCreateVolumePermissionsOnSnapshotInRegion",
|
Invokable<?, ?> method = method(ElasticBlockStoreApi.class, "resetCreateVolumePermissionsOnSnapshotInRegion",
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
@ -22,8 +22,9 @@ import static org.testng.Assert.assertNotNull;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
import org.jclouds.ec2.compute.EC2ComputeServiceContext;
|
||||||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -31,30 +32,30 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ElasticIPAddressClient}
|
* Tests behavior of {@code ElasticIPAddressApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "ElasticIPAddressClientLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "ElasticIPAddressApiLiveTest")
|
||||||
public class ElasticIPAddressClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class ElasticIPAddressApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
public ElasticIPAddressClientLiveTest() {
|
public ElasticIPAddressApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
private EC2Client ec2Client;
|
private EC2Api ec2Api;
|
||||||
private ElasticIPAddressClient client;
|
private ElasticIPAddressApi client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
ec2Api = view.unwrapApi(EC2Api.class);
|
||||||
client = ec2Client.getElasticIPAddressServices();
|
client = ec2Api.getElasticIPAddressApi().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDescribeAddresses() {
|
void testDescribeAddresses() {
|
||||||
for (String region : ec2Client.getConfiguredRegions()) {
|
for (String region : ec2Api.getConfiguredRegions()) {
|
||||||
SortedSet<PublicIpInstanceIdPair> allResults = Sets.newTreeSet(client.describeAddressesInRegion(region));
|
SortedSet<PublicIpInstanceIdPair> allResults = Sets.newTreeSet(client.describeAddressesInRegion(region));
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
if (allResults.size() >= 1) {
|
if (allResults.size() >= 1) {
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.reflect.Reflection2.method;
|
import static org.jclouds.reflect.Reflection2.method;
|
||||||
|
|
||||||
|
@ -32,16 +32,16 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ElasticIPAddressAsyncClient}
|
* Tests behavior of {@code ElasticIPAddressApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "ElasticIPAddressAsyncClientTest")
|
@Test(groups = "unit", testName = "ElasticIPAddressApiTest")
|
||||||
public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<ElasticIPAddressAsyncClient> {
|
public class ElasticIPAddressApiTest extends BaseEC2ApiTest<ElasticIPAddressApi> {
|
||||||
|
|
||||||
public void testDisassociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDisassociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "disassociateAddressInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticIPAddressApi.class, "disassociateAddressInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "associateAddressInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticIPAddressApi.class, "associateAddressInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1", "me"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1", "me"));
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReleaseAddress() throws SecurityException, NoSuchMethodException, IOException {
|
public void testReleaseAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "releaseAddressInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(ElasticIPAddressApi.class, "releaseAddressInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -106,7 +106,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeAddresses() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeAddresses() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "describeAddressesInRegion", String.class,
|
Invokable<?, ?> method = method(ElasticIPAddressApi.class, "describeAddressesInRegion", String.class,
|
||||||
String[].class);
|
String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAllocateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAllocateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "allocateAddressInRegion", String.class);
|
Invokable<?, ?> method = method(ElasticIPAddressApi.class, "allocateAddressInRegion", String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
@ -14,45 +14,45 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
import org.jclouds.ec2.EC2ApiMetadata;
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code EC2Client}
|
* Tests behavior of {@code EC2Api}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "InstanceClientLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "InstanceApiLiveTest")
|
||||||
public class InstanceClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class InstanceApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
public InstanceClientLiveTest() {
|
public InstanceApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
private EC2Client ec2Client;
|
private EC2Api ec2Api;
|
||||||
private InstanceClient client;
|
private InstanceApi client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
ec2Api = view.unwrapApi(EC2Api.class);
|
||||||
client = ec2Client.getInstanceServices();
|
client = ec2Api.getInstanceApi().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDescribeInstances() {
|
void testDescribeInstances() {
|
||||||
for (String region : ec2Client.getConfiguredRegions()) {
|
for (String region : ec2Api.getConfiguredRegions()) {
|
||||||
Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
|
Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
assert allResults.size() >= 0 : allResults.size();
|
assert allResults.size() >= 0 : allResults.size();
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.ec2.services;
|
package org.jclouds.ec2.features;
|
||||||
|
|
||||||
import static org.jclouds.reflect.Reflection2.method;
|
import static org.jclouds.reflect.Reflection2.method;
|
||||||
|
|
||||||
|
@ -47,15 +47,15 @@ import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code InstanceAsyncClient}
|
* Tests behavior of {@code InstanceApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "InstanceAsyncClientTest")
|
@Test(groups = "unit", testName = "InstanceApiTest")
|
||||||
public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyncClient> {
|
public class InstanceApiTest extends BaseEC2ApiTest<InstanceApi> {
|
||||||
public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "describeInstancesInRegion", String.class, String[].class);
|
Invokable<?, ?> method = method(InstanceApi.class, "describeInstancesInRegion", String.class, String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -71,7 +71,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeInstancesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeInstancesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "describeInstancesInRegion", String.class, String[].class);
|
Invokable<?, ?> method = method(InstanceApi.class, "describeInstancesInRegion", String.class, String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -87,7 +87,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTerminateInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testTerminateInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "terminateInstancesInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "terminateInstancesInRegion", String.class,
|
||||||
String[].class);
|
String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRunInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRunInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "runInstancesInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "runInstancesInRegion", String.class, String.class,
|
||||||
String.class, int.class, int.class, RunInstancesOptions[].class);
|
String.class, int.class, int.class, RunInstancesOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null, "ami-voo", 1, 1));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null, "ami-voo", 1, 1));
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRunInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRunInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "runInstancesInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "runInstancesInRegion", String.class, String.class,
|
||||||
String.class, int.class, int.class, RunInstancesOptions[].class);
|
String.class, int.class, int.class, RunInstancesOptions[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("eu-west-1", "eu-west-1a", "ami-voo",
|
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("eu-west-1", "eu-west-1a", "ami-voo",
|
||||||
1, 5, new RunInstancesOptions().withKernelId("kernelId").withSecurityGroups("group1", "group2")));
|
1, 5, new RunInstancesOptions().withKernelId("kernelId").withSecurityGroups("group1", "group2")));
|
||||||
|
@ -153,7 +153,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStopInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testStopInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "stopInstancesInRegion", String.class, boolean.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "stopInstancesInRegion", String.class, boolean.class,
|
||||||
String[].class);
|
String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, true, "1", "2"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, true, "1", "2"));
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRebootInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRebootInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "rebootInstancesInRegion", String.class, String[].class);
|
Invokable<?, ?> method = method(InstanceApi.class, "rebootInstancesInRegion", String.class, String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -186,7 +186,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStartInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testStartInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "startInstancesInRegion", String.class, String[].class);
|
Invokable<?, ?> method = method(InstanceApi.class, "startInstancesInRegion", String.class, String[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -202,7 +202,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getUserDataForInstanceInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(InstanceApi.class, "getUserDataForInstanceInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -219,7 +219,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetRootDeviceNameForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetRootDeviceNameForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getRootDeviceNameForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "getRootDeviceNameForInstanceInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getRamdiskForInstanceInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(InstanceApi.class, "getRamdiskForInstanceInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -255,7 +255,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
public void testGetDisableApiTerminationForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testGetDisableApiTerminationForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "isApiTerminationDisabledForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "isApiTerminationDisabledForInstanceInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getKernelForInstanceInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(InstanceApi.class, "getKernelForInstanceInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
@ -289,7 +289,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getInstanceTypeForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "getInstanceTypeForInstanceInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
public void testGetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
public void testGetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
Invokable<?, ?> method = method(InstanceApi.class, "getInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
public void testGetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testGetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getBlockDeviceMappingForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "getBlockDeviceMappingForInstanceInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setUserDataForInstanceInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "setUserDataForInstanceInRegion", String.class, String.class,
|
||||||
byte[].class);
|
byte[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setRamdiskForInstanceInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "setRamdiskForInstanceInRegion", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setKernelForInstanceInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "setKernelForInstanceInRegion", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setApiTerminationDisabledForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||||
String.class, boolean.class);
|
String.class, boolean.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setInstanceTypeForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "setInstanceTypeForInstanceInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
Invokable<?, ?> method = method(InstanceApi.class, "setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceApi.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
||||||
String.class, Map.class);
|
String.class, Map.class);
|
||||||
|
|
||||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||||
|
@ -575,7 +575,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetConsoleOutputForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetConsoleOutputForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getConsoleOutputForInstanceInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(InstanceApi.class, "getConsoleOutputForInstanceInRegion", String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue