org.dasein.cloud.aws
Class AWSCloud

java.lang.Object
  extended by org.dasein.cloud.CloudProvider
      extended by org.dasein.cloud.AbstractCloud
          extended by org.dasein.cloud.aws.AWSCloud

public class AWSCloud
extends org.dasein.cloud.AbstractCloud


Field Summary
static String CLOUD_FRONT_ALGORITHM
           
static String DSN_ACCESS_KEY
           
static String EC2_ALGORITHM
           
static String P_ACCESS
           
static String P_ACTION
           
static String P_AWS_DATE
           
static String P_CFAUTH
           
static String P_GOOG_DATE
           
static String P_SIGNATURE
           
static String P_SIGNATURE_METHOD
           
static String P_SIGNATURE_VERSION
           
static String P_TIMESTAMP
           
static String P_VERSION
           
static String PLATFORM_EC2
           
static String PLATFORM_VPC
           
static String S3_ALGORITHM
           
static String SIGNATURE
           
static String V4_ALGORITHM
           
static String V4_TERMINATION
           
 
Constructor Summary
AWSCloud()
           
 
Method Summary
static String computeSHA256Hash(String value)
           
 boolean createTags(String[] resourceIds, org.dasein.cloud.Tag... keyValuePairs)
           
 boolean createTags(String resourceId, org.dasein.cloud.Tag... keyValuePairs)
           
static String encode(String value, boolean encodePath)
           
static String escapeXml(String nonxml)
           
 byte[][] getAccessKey(org.dasein.cloud.ProviderContext ctx)
           
 AWSAdminServices getAdminServices()
           
 String getAutoScaleVersion()
           
static boolean getBooleanValue(Node node)
          Returns the boolean value of the given node.
 String getCloudName()
           
 String getCloudWatchVersion()
           
 EC2ComputeServices getComputeServices()
           
 org.dasein.cloud.ContextRequirements getContextRequirements()
           
 RegionsAndZones getDataCenterServices()
           
 double getDoubleValue(Node node)
          Returns the double value of the given node.
 EC2Provider getEC2Provider()
           
 String getEc2Url()
           
 String getEc2Url(String regionId)
           
 String getEc2Version()
           
 String getElbVersion()
           
 String getGlacierUrl()
           
 AWSIdentityServices getIdentityServices()
           
 int getIntValue(Node node)
          Returns the int value of the given node.
static org.apache.log4j.Logger getLogger(Class<?> cls)
           
 EC2NetworkServices getNetworkServices()
           
 AWSPlatformServices getPlatformServices()
           
 String getProviderName()
           
 String getProxyHost()
           
 int getProxyPort()
           
 String getRdsVersion()
           
 String getRoute53Version()
           
 String getSdbVersion()
           
 String getSnsVersion()
           
 String getSqsVersion()
           
 Map<String,String> getStandardCloudWatchParameters(org.dasein.cloud.ProviderContext ctx, String action)
           
 Map<String,String> getStandardParameters(org.dasein.cloud.ProviderContext ctx, String action)
           
 Map<String,String> getStandardParameters(org.dasein.cloud.ProviderContext ctx, String action, String version)
           
 Map<String,String> getStandardRdsParameters(org.dasein.cloud.ProviderContext ctx, String action)
           
 Map<String,String> getStandardSimpleDBParameters(org.dasein.cloud.ProviderContext ctx, String action)
           
 Map<String,String> getStandardSnsParameters(org.dasein.cloud.ProviderContext ctx, String action)
           
 Map<String,String> getStandardSqsParameters(org.dasein.cloud.ProviderContext ctx, String action)
           
 AWSCloudStorageServices getStorageServices()
           
 Map<String,String> getTagFilterParams(Map<String,String> tags)
           
 Map<String,String> getTagFilterParams(Map<String,String> tags, int startingFilterIndex)
           
 Map<String,String> getTagsFromTagSet(Node attr)
           
static String getTextValue(Node node)
          Returns the text from the given node.
 String getTimestamp(long timestamp, boolean withMillis)
           
 long getTimestampValue(Node node)
          Gets the epoch form of the text value of the provided node.
 String getV4Authorization(String accessKey, String secretKey, String action, String url, String serviceId, Map<String,String> headers, String bodyHash)
          Generates an AWS v4 signature authorization string
 String getV4HeaderDate(Date date)
           
static org.apache.log4j.Logger getWireLogger(Class<?> cls)
           
static byte[] HmacSHA256(String data, byte[] key)
           
 boolean isEC2Supported()
           
 long parseTime(String time)
           
 void putExtraParameters(Map<String,String> parameters, Map<String,String> extraParameters)
           
 void putIndexedMapParameters(Map<String,String> parameters, String prefix, Map<String,String> extraParameters)
          Helper method for adding indexed member parameters, e.g.
 void putIndexedParameters(Map<String,String> parameters, String prefix, String[] values)
          Helper method for adding indexed member parameters, e.g.
 void putValueIfNotNull(Map<String,String> parameters, String key, String value)
          Puts the given key/value into the given map only if the value is not null.
 boolean removeTags(String[] resourceIds, org.dasein.cloud.Tag... keyValuePairs)
           
 boolean removeTags(String resourceId, org.dasein.cloud.Tag... keyValuePairs)
           
 void setTags(Node attr, org.dasein.cloud.Taggable item)
           
 String signAWS3(String keyId, byte[] key, String dateString)
           
 String signCloudFront(String accessKey, byte[] secretKey, String dateString)
           
 String signEc2(byte[] key, String serviceUrl, Map<String,String> parameters)
           
 String signS3(String accessKey, byte[] secretKey, String action, String hash, String contentType, Map<String,String> headers, String bucket, String object)
           
 String signUploadPolicy(String base64Policy)
           
 String testContext()
           
 
Methods inherited from class org.dasein.cloud.AbstractCloud
getCIServices
 
Methods inherited from class org.dasein.cloud.CloudProvider
close, connect, connect, findUniqueName, getComputeCloud, getContext, hasAdminServices, hasCIServices, hasComputeServices, hasIdentityServices, hasNetworkServices, hasPlatformServices, hasStorageServices, hold, isConnected, matchesTags, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P_ACCESS

public static final String P_ACCESS
See Also:
Constant Field Values

P_ACTION

public static final String P_ACTION
See Also:
Constant Field Values

P_CFAUTH

public static final String P_CFAUTH
See Also:
Constant Field Values

P_AWS_DATE

public static final String P_AWS_DATE
See Also:
Constant Field Values

P_GOOG_DATE

public static final String P_GOOG_DATE
See Also:
Constant Field Values

P_SIGNATURE

public static final String P_SIGNATURE
See Also:
Constant Field Values

P_SIGNATURE_METHOD

public static final String P_SIGNATURE_METHOD
See Also:
Constant Field Values

P_SIGNATURE_VERSION

public static final String P_SIGNATURE_VERSION
See Also:
Constant Field Values

P_TIMESTAMP

public static final String P_TIMESTAMP
See Also:
Constant Field Values

P_VERSION

public static final String P_VERSION
See Also:
Constant Field Values

CLOUD_FRONT_ALGORITHM

public static final String CLOUD_FRONT_ALGORITHM
See Also:
Constant Field Values

EC2_ALGORITHM

public static final String EC2_ALGORITHM
See Also:
Constant Field Values

S3_ALGORITHM

public static final String S3_ALGORITHM
See Also:
Constant Field Values

SIGNATURE

public static final String SIGNATURE
See Also:
Constant Field Values

V4_ALGORITHM

public static final String V4_ALGORITHM
See Also:
Constant Field Values

V4_TERMINATION

public static final String V4_TERMINATION
See Also:
Constant Field Values

PLATFORM_EC2

public static final String PLATFORM_EC2
See Also:
Constant Field Values

PLATFORM_VPC

public static final String PLATFORM_VPC
See Also:
Constant Field Values

DSN_ACCESS_KEY

public static final String DSN_ACCESS_KEY
See Also:
Constant Field Values
Constructor Detail

AWSCloud

public AWSCloud()
Method Detail

getLogger

public static org.apache.log4j.Logger getLogger(Class<?> cls)

getWireLogger

public static org.apache.log4j.Logger getWireLogger(Class<?> cls)

encode

@Nonnull
public static String encode(@Nonnull
                                    String value,
                                    boolean encodePath)
                     throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

escapeXml

public static String escapeXml(String nonxml)

HmacSHA256

public static byte[] HmacSHA256(String data,
                                byte[] key)
                         throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

computeSHA256Hash

public static String computeSHA256Hash(String value)
                                throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

createTags

public boolean createTags(String resourceId,
                          org.dasein.cloud.Tag... keyValuePairs)

createTags

public boolean createTags(String[] resourceIds,
                          org.dasein.cloud.Tag... keyValuePairs)

removeTags

public boolean removeTags(String resourceId,
                          org.dasein.cloud.Tag... keyValuePairs)

removeTags

public boolean removeTags(String[] resourceIds,
                          org.dasein.cloud.Tag... keyValuePairs)

getTagsFromTagSet

public Map<String,String> getTagsFromTagSet(Node attr)

getAdminServices

public AWSAdminServices getAdminServices()
Overrides:
getAdminServices in class org.dasein.cloud.AbstractCloud

getCloudName

@Nonnull
public String getCloudName()
Specified by:
getCloudName in class org.dasein.cloud.CloudProvider

getComputeServices

public EC2ComputeServices getComputeServices()
Overrides:
getComputeServices in class org.dasein.cloud.AbstractCloud

getContextRequirements

@Nonnull
public org.dasein.cloud.ContextRequirements getContextRequirements()
Overrides:
getContextRequirements in class org.dasein.cloud.AbstractCloud

getAccessKey

public byte[][] getAccessKey(org.dasein.cloud.ProviderContext ctx)

getDataCenterServices

@Nonnull
public RegionsAndZones getDataCenterServices()
Specified by:
getDataCenterServices in class org.dasein.cloud.CloudProvider

getEC2Provider

@Nonnull
public EC2Provider getEC2Provider()

getEc2Url

@Nullable
public String getEc2Url()
                 throws org.dasein.cloud.InternalException,
                        org.dasein.cloud.CloudException
Throws:
org.dasein.cloud.InternalException
org.dasein.cloud.CloudException

getEc2Url

@Nullable
public String getEc2Url(@Nullable
                                 String regionId)
                 throws org.dasein.cloud.InternalException,
                        org.dasein.cloud.CloudException
Throws:
org.dasein.cloud.InternalException
org.dasein.cloud.CloudException

getGlacierUrl

public String getGlacierUrl()
                     throws org.dasein.cloud.InternalException,
                            org.dasein.cloud.CloudException
Throws:
org.dasein.cloud.InternalException
org.dasein.cloud.CloudException

getAutoScaleVersion

public String getAutoScaleVersion()

getCloudWatchVersion

public String getCloudWatchVersion()

getEc2Version

public String getEc2Version()

getElbVersion

public String getElbVersion()

getRdsVersion

public String getRdsVersion()

getRoute53Version

public String getRoute53Version()

getSdbVersion

public String getSdbVersion()

getSnsVersion

public String getSnsVersion()

getSqsVersion

public String getSqsVersion()

getIdentityServices

public AWSIdentityServices getIdentityServices()
Overrides:
getIdentityServices in class org.dasein.cloud.AbstractCloud

getNetworkServices

public EC2NetworkServices getNetworkServices()
Overrides:
getNetworkServices in class org.dasein.cloud.AbstractCloud

getPlatformServices

@Nullable
public AWSPlatformServices getPlatformServices()
Overrides:
getPlatformServices in class org.dasein.cloud.AbstractCloud

getProviderName

@Nonnull
public String getProviderName()
Specified by:
getProviderName in class org.dasein.cloud.CloudProvider

getProxyHost

@Nullable
public String getProxyHost()

getProxyPort

public int getProxyPort()

getStorageServices

@Nonnull
public AWSCloudStorageServices getStorageServices()
Overrides:
getStorageServices in class org.dasein.cloud.CloudProvider

getStandardParameters

public Map<String,String> getStandardParameters(org.dasein.cloud.ProviderContext ctx,
                                                String action)
                                         throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getStandardParameters

public Map<String,String> getStandardParameters(org.dasein.cloud.ProviderContext ctx,
                                                String action,
                                                String version)
                                         throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getStandardCloudWatchParameters

public Map<String,String> getStandardCloudWatchParameters(org.dasein.cloud.ProviderContext ctx,
                                                          String action)
                                                   throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getStandardRdsParameters

public Map<String,String> getStandardRdsParameters(org.dasein.cloud.ProviderContext ctx,
                                                   String action)
                                            throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getStandardSimpleDBParameters

public Map<String,String> getStandardSimpleDBParameters(org.dasein.cloud.ProviderContext ctx,
                                                        String action)
                                                 throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getStandardSnsParameters

public Map<String,String> getStandardSnsParameters(org.dasein.cloud.ProviderContext ctx,
                                                   String action)
                                            throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getStandardSqsParameters

public Map<String,String> getStandardSqsParameters(org.dasein.cloud.ProviderContext ctx,
                                                   String action)
                                            throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

putExtraParameters

public void putExtraParameters(Map<String,String> parameters,
                               Map<String,String> extraParameters)

getTagFilterParams

@Nullable
public Map<String,String> getTagFilterParams(@Nullable
                                                      Map<String,String> tags)

getTagFilterParams

@Nullable
public Map<String,String> getTagFilterParams(@Nullable
                                                      Map<String,String> tags,
                                                      int startingFilterIndex)

getTimestamp

@Nonnull
public String getTimestamp(long timestamp,
                                   boolean withMillis)

parseTime

public long parseTime(@Nullable
                      String time)
               throws org.dasein.cloud.CloudException
Throws:
org.dasein.cloud.CloudException

signUploadPolicy

public String signUploadPolicy(String base64Policy)
                        throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

signCloudFront

public String signCloudFront(String accessKey,
                             byte[] secretKey,
                             String dateString)
                      throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

signEc2

public String signEc2(byte[] key,
                      String serviceUrl,
                      Map<String,String> parameters)
               throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

signAWS3

public String signAWS3(String keyId,
                       byte[] key,
                       String dateString)
                throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

signS3

public String signS3(String accessKey,
                     byte[] secretKey,
                     String action,
                     String hash,
                     String contentType,
                     Map<String,String> headers,
                     String bucket,
                     String object)
              throws org.dasein.cloud.InternalException
Throws:
org.dasein.cloud.InternalException

getV4Authorization

public String getV4Authorization(String accessKey,
                                 String secretKey,
                                 String action,
                                 String url,
                                 String serviceId,
                                 Map<String,String> headers,
                                 String bodyHash)
                          throws org.dasein.cloud.InternalException
Generates an AWS v4 signature authorization string

Parameters:
accessKey - Amazon credential
secretKey - Amazon credential
action - the HTTP method (GET, POST, etc)
url - the full URL for the request, including any query parameters
serviceId - the canonical name of the service targeted in the request (e.g. "glacier")
headers - map of headers of request. MUST include x-amz-date or date header.
bodyHash - a hex-encoded sha256 hash of the body of the request
Returns:
a string suitable for including as the HTTP Authorization header
Throws:
org.dasein.cloud.InternalException

getV4HeaderDate

public String getV4HeaderDate(Date date)

testContext

public String testContext()
Overrides:
testContext in class org.dasein.cloud.CloudProvider

setTags

public void setTags(@Nonnull
                    Node attr,
                    @Nonnull
                    org.dasein.cloud.Taggable item)

getTimestampValue

public long getTimestampValue(Node node)
                       throws org.dasein.cloud.CloudException
Gets the epoch form of the text value of the provided node.

Parameters:
node - the node to extact the value from
Returns:
the epoch time
Throws:
org.dasein.cloud.CloudException

getTextValue

public static String getTextValue(Node node)
Returns the text from the given node.

Parameters:
node - the node to extract the value from
Returns:
the text from the node

getBooleanValue

public static boolean getBooleanValue(Node node)
Returns the boolean value of the given node.

Parameters:
node - the node to extract the value from
Returns:
the boolean value of the node

getIntValue

public int getIntValue(Node node)
Returns the int value of the given node.

Parameters:
node - the node to extract the value from
Returns:
the int value of the given node

getDoubleValue

public double getDoubleValue(Node node)
Returns the double value of the given node.

Parameters:
node - the node to extract the value from
Returns:
the double value of the given node

putIndexedParameters

public void putIndexedParameters(@Nonnull
                                 Map<String,String> parameters,
                                 @Nonnull
                                 String prefix,
                                 String[] values)
Helper method for adding indexed member parameters, e.g. AlarmNames.member.N. Will overwrite existing parameters if present. Assumes indexing starts at 1.

Parameters:
parameters - the existing parameters map to add to
prefix - the prefix value for each parameter key
values - the values to add

putIndexedMapParameters

public void putIndexedMapParameters(@Nonnull
                                    Map<String,String> parameters,
                                    @Nonnull
                                    String prefix,
                                    Map<String,String> extraParameters)
Helper method for adding indexed member parameters, e.g. AlarmNames.member.N. Will overwrite existing parameters if present. Assumes indexing starts at 1.

Parameters:
parameters - the existing parameters map to add to
prefix - the prefix value for each parameter key
extraParameters - the values to add

putValueIfNotNull

public void putValueIfNotNull(@Nonnull
                              Map<String,String> parameters,
                              @Nonnull
                              String key,
                              String value)
Puts the given key/value into the given map only if the value is not null.

Parameters:
parameters - the map to add to
key - the key of the value
value - the value to add if not null

isEC2Supported

public boolean isEC2Supported()
Returns:


Copyright © 2009-2014 Dell, Inc.. All Rights Reserved.