Skip to content

Commit

Permalink
#1760 Create RightAws 1.8.1 release branch
Browse files Browse the repository at this point in the history
git-svn-id: https://wush.net/svn/rightscale/right_aws/release_1_8_1@5974 9f0cbaf6-ce18-0410-ad37-d14a22affa91
  • Loading branch information
trbryan committed Oct 7, 2008
2 parents 4559fdc + d8e3e7f commit a88f9ac
Show file tree
Hide file tree
Showing 13 changed files with 487 additions and 67 deletions.
31 changes: 28 additions & 3 deletions History.txt
Expand Up @@ -174,8 +174,33 @@ Initial release.

- Removed the 1.7.2 monkey-patch of the Ruby File class on Windows. This patch broke Rails 2.0.
The patch is now included in the README for anyone to use at their own risk.


== 1.8.0

Release Notes:

This release adds major new features to RightAws to support Amazon's new
Elastic Block Store (EBS). Via the RightAws::Ec2 module, users can create
and delete EBS volumes, attach and detach them from instances, snapshot
volumes, and list the available volumes and snapshots.

Bug fixes include correction of RightAws::S3 copy's failure to url-encode
the source key.

== 1.8.1

* r5111, konstantin, 2008-08-19 16:19:06 +0400
* #1526, fixed: Right_S3 copy fails to url-encode source
Release Notes:

RightScale::SdbInterface & ::ActiveSdb have several enhancements, including:
- RightAws::SdbInterface#last_query_expression added for debug puposes
- RightAws::ActiveSdb::Base#query :order and :auto_load options added to support query
result sorting and attributes auto loading
- RightAws::ActiveSdb::Base#find_all_by_ and find_by_ helpers improved to support
:order, :auto_load, :limit and :next_token options
- RightAws::SdbInterface#delete_attributes bug fixed
- SdbInterface allows specification of a string value to use for
representing Ruby nil in SDB.
- Sdb tests fixed and improved

The ::S3 interface now has support for S3's server access logging.
Amazon considers server access logging to be a beta or provisional feature.
9 changes: 5 additions & 4 deletions README.txt
Expand Up @@ -5,17 +5,18 @@ For information about RightScale, see http://www.rightscale.com

== DESCRIPTION:

The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, Amazon S3, Amazon SQS, and Amazon SDB. These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon. The RightScale AWS gems comprise:
The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, EBS, S3, SQS, and SDB. These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon. The RightScale AWS gems comprise:

- RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud)
- RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud) and the
associated EBS (Elastic Block Store)
- RightAws::S3 and RightAws::S3Interface -- interface to Amazon S3 (Simple Storage Service)
- RightAws::Sqs and RightAws::SqsInterface -- interface to first-generation Amazon SQS (Simple Queue Service) (API version 2007-05-01)
- RightAws::SqsGen2 and RightAws::SqsGen2Interface -- interface to second-generation Amazon SQS (Simple Queue Service) (API version 2008-01-01)
- RightAws::SdbInterface and RightAws::ActiveSdb -- interface to Amazon SDB (SimpleDB)

== FEATURES:

- Full programmmatic access to EC2, S3, SQS, and SDB.
- Full programmmatic access to EC2, EBS, S3, SQS, and SDB.
- Complete error handling: all operations check for errors and report complete
error information by raising an AwsError.
- Persistent HTTP connections with robust network-level retry layer using
Expand Down Expand Up @@ -123,7 +124,7 @@ multithreaded mode.

== REQUIREMENTS:

RightAws requires REXML and the RightHttpConnection gem.
RightAws requires REXML and the right_http_connection gem.
If libxml and its Ruby bindings (distributed in the libxml-ruby gem) are
present, RightAws can be configured to use them:
RightAws::RightAWSParser.xml_lib = 'libxml'
Expand Down
18 changes: 18 additions & 0 deletions lib/awsbase/right_awsbase.rb
Expand Up @@ -24,6 +24,7 @@
# Test
module RightAws
require 'md5'
require 'pp'

class AwsUtils #:nodoc:
@@digest = OpenSSL::Digest::Digest.new("sha1")
Expand All @@ -44,6 +45,23 @@ def self.URLencode(raw)
e = URI.escape(raw)
e.gsub(/\+/, "%2b")
end

def self.allow_only(allowed_keys, params)
bogus_args = []
params.keys.each {|p| bogus_args.push(p) unless allowed_keys.include?(p) }
raise AwsError.new("The following arguments were given but are not legal for the function call #{caller_method}: #{bogus_args.inspect}") if bogus_args.length > 0
end

def self.mandatory_arguments(required_args, params)
rargs = required_args.dup
params.keys.each {|p| rargs.delete(p)}
raise AwsError.new("The following mandatory arguments were not provided to #{caller_method}: #{rargs.inspect}") if rargs.length > 0
end

def self.caller_method
caller[1]=~/`(.*?)'/
$1
end

end

Expand Down
11 changes: 6 additions & 5 deletions lib/ec2/right_ec2.rb
Expand Up @@ -25,7 +25,8 @@ module RightAws

# = RightAWS::EC2 -- RightScale Amazon EC2 interface
# The RightAws::EC2 class provides a complete interface to Amazon's
# Elastic Compute Cloud service.
# Elastic Compute Cloud service, as well as the associated EBS (Elastic Block
# Store).
# For explanations of the semantics
# of each call, please refer to Amazon's documentation at
# http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=87
Expand Down Expand Up @@ -67,7 +68,7 @@ class Ec2 < RightAwsBase
include RightAwsBaseInterface

# Amazon EC2 API version being used
API_VERSION = "2008-02-01"
API_VERSION = "2008-05-05"
DEFAULT_HOST = "ec2.amazonaws.com"
DEFAULT_PATH = '/'
DEFAULT_PROTOCOL = 'https'
Expand Down Expand Up @@ -1404,7 +1405,7 @@ def tagend(name)
when 'device' then @result[:aws_device] = @text
when 'status' then @result[:aws_attachment_status] = @text
when 'attachTime' then @result[:aws_attached_at] = Time.parse(@text)
end
end
end
def reset
@result = {}
Expand All @@ -1416,8 +1417,8 @@ def tagstart(name, attributes)
case name
when 'item'
case @xmlpath
when 'DescribeVolumesResponse/volumeSet' then @volume = {}
end
when 'DescribeVolumesResponse/volumeSet' then @volume = {}
end
end
end
def tagend(name)
Expand Down
38 changes: 38 additions & 0 deletions lib/s3/right_s3.rb
Expand Up @@ -53,6 +53,14 @@ class S3
# Create a new handle to an S3 account. All handles share the same per process or per thread
# HTTP connection to Amazon S3. Each handle is for a specific account.
# The +params+ are passed through as-is to RightAws::S3Interface.new
#
# Params is a hash:
#
# {:server => 's3.amazonaws.com' # Amazon service host: 's3.amazonaws.com'(default)
# :port => 443 # Amazon service port: 80 or 443(default)
# :protocol => 'https' # Amazon service protocol: 'http' or 'https'(default)
# :multi_thread => true|false # Multi-threaded (connection per each thread): true or false(default)
# :logger => Logger Object} # Logger instance: logs to STDOUT if omitted }
def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
@interface = S3Interface.new(aws_access_key_id, aws_secret_access_key, params)
end
Expand Down Expand Up @@ -161,6 +169,36 @@ def public_link
def location
@location ||= @s3.interface.bucket_location(@name)
end

# Retrieves the logging configuration for a bucket.
# Returns a hash of {:enabled, :targetbucket, :targetprefix}
#
# bucket.logging_info()
# => {:enabled=>true, :targetbucket=>"mylogbucket", :targetprefix=>"loggylogs/"}
def logging_info
@s3.interface.get_logging_parse(:bucket => @name)
end

# Enables S3 server access logging on a bucket. The target bucket must have been properly configured to receive server
# access logs.
# Params:
# :targetbucket - either the target bucket object or the name of the target bucket
# :targetprefix - the prefix under which all logs should be stored
#
# bucket.enable_logging(:targetbucket=>"mylogbucket", :targetprefix=>"loggylogs/")
# => true
def enable_logging(params)
AwsUtils.mandatory_arguments([:targetbucket, :targetprefix], params)
AwsUtils.allow_only([:targetbucket, :targetprefix], params)
xmldoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><BucketLoggingStatus xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"><LoggingEnabled><TargetBucket>#{params[:targetbucket]}</TargetBucket><TargetPrefix>#{params[:targetprefix]}</TargetPrefix></LoggingEnabled></BucketLoggingStatus>"
@s3.interface.put_logging(:bucket => @name, :xmldoc => xmldoc)
end

# Disables S3 server access logging on a bucket. Takes no arguments.
def disable_logging
xmldoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><BucketLoggingStatus xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"></BucketLoggingStatus>"
@s3.interface.put_logging(:bucket => @name, :xmldoc => xmldoc)
end

# Retrieve a group of keys from Amazon.
# +options+ is a hash: { 'prefix'=>'', 'marker'=>'', 'max-keys'=>5, 'delimiter'=>'' }).
Expand Down

0 comments on commit a88f9ac

Please sign in to comment.